Reputation: 1195
I am building an IntelliJ idea plugin. I have a component TemplateComponent.java which extends the ApplicationComponent. Here is the link to the code.
I want to read some template files in the TemplateLoader. All the files are placed under root_of_project/templates. When I build the jar and install it in my IDE, I am not able to get access to the files because the plugin is packed as a jar file. However, things work as intended when I am debugging the plugin from within the IDE. Can anyone help me?
Upvotes: 1
Views: 1322
Reputation: 18931
Please see com.intellij.util.PathUtil#getJarPathForClass and its usages in IDEA codebase. Unfortunately you might have to add a check if it's a directory (debug) or a jar (production), like in com.intellij.compiler.server.BuildManager#getJpsPluginSystemClassesPath
Upvotes: 1