Plugin : Best way to safe a file in a project structure?



I have written a small Java plugin in IntellIJ IDEA. This plugin allows me to create a yaml file.

I want to save it in my project structure using the doOKAction function.

If I hard code the path, it will work. But if I run my plugin on another computer it will not work. (Of course)

I would use:

Path root = Paths.get(".").normalize().toAbsolutePath();

but this isn't working...

Because the plugin is not included in the current project structure and i would get something like this :

"C:\Users\**\.gradle\caches\modules-2\files-2.1\com.jetbrains.intellij.idea\ideaIC\2019.3.2\b911671d7501d9fd63cea3eee8287d8ceb4113c6\ideaIC-2019.3.2\bin ..."

If there is a way at all, what would be the best way to store a file somewhere in the project structure?

Many thanks and best regards

1 comment
Comment actions Permalink


You should create such a path using i.e.


as the base for your target destination.


Please sign in to leave a comment.