How to determine module relative path of a VirtualFile

I need to display the relative path of a virtual file.
e.g. \[Module content root]\scripts\test.sql

Could theoretically parse the VirtualFile.getPath() value, still, how do i get hold of the content roots of a module?

1 comment
Comment actions Permalink

Module module = ModuleUtil.findModuleForPsiElement(psiFile);

ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
VirtualFile[] contentRoots = rootManager.getContentRoots();


Please sign in to leave a comment.