I need to get source file path related to current source directory. For example, if I have Maven project with path:
I need to get "/com/test/".
But if will be simple Java Project with path: /home/username/Projects/MyProject/src/com/test/MyFileTest.java
In this case I also need to get "/com/test/".
I made it via:
PsiDirectory psiFileParent = psiFile.getParent();
ItemPresentation presentation = PsiDirectory.class.cast(psiFileParent).getPresentation();
String locationString = presentation.getLocationString();
But this approach don't work for PyCharm projects (or for GoLand).
Can you, please, help me?