How to detect whether a file is part of a webapp resource dir

Answered

I keep it short and simple, how do I detect if a virtual file is part of a web resource dir.

For normal sources and resources this seems to do the trick

ProjectFileIndex.getInstance(project).getSourceRootForFile(virtualFile)

But this fails for web resources by returning null on them. I guess the necessary code is in a plugin which is not opensource, but there might be a way to achieve that.

 

 

 

 

2 comments
Comment actions Permalink

com.intellij.javaee.web.WebUtil#isInsideWebRoots(com.intellij.openapi.vfs.VirtualFile, com.intellij.openapi.project.Project) (requires JavaEE plugin)

0
Comment actions Permalink

Thanks a lot.

That will help me a lot, it was not that obvious.

Cheers and thanks for the quick answer.

Btw. just in case you guys are interested: https://github.com/werpu/tinydecscodegen

it does some stuff differently and is complentary to your angular tooling in parts.

 

0

Please sign in to leave a comment.