Is there a way to get the path of the current project directory using the IntelliJ Plugin SDK?
Let's say I create a new project under ~/sampleProject
and open it with IntelliJ. Then I want to create a plugin which displays the current project path ~/sampleProject
.
I tried this
File(".").absolutePath
which is the path of the IntelliJ_path/bin
directory, not the current working directory.
I found the solution myself:
When you create a widget using the StatusBarWidgetFactory
you have to implement the following method:
override fun createWidget(project: Project)
Where the project
object knows the path: project.basePath
.