Reputation: 48850
I'm writing an Eclipse plugin and I need to save some properties files and binary files as metadata of the plugin. The idea is that when the user starts Eclipse next day he/she won't need to configure/type all again from scratch.
I'm good about writing and reading the files, but I'm not sure about the best location for them. It seems like the perfect location would be something like:
<WORKSPACE_HOME>/.metadata/.plugins/org.myplugin.name
But how do I get or assemble this path? So far I've got to assemble this path as shown below:
<WORKSPACE_HOME>
: I could use ResourcesPlugin.getWorkspace().getRoot().getLocation()
..metadata/.plugins
: Should I hard code this section? Could it change in the future?org.myplugin.name
: This is the easy one since it's my plugin name.Is it possible to get that path without hard coding values?
Do I need to create the last directory (my plugin name)? (I guess I need to)
Upvotes: 0
Views: 321
Reputation: 20003
Ask org.eclipse.core.runtime.Platform
for your Bundle
's "private" state location. If you have a plug-in activator, you can get the Bundle
from there. Otherwise, there's a different method on Platform
to get the right instance based on the ID.
Upvotes: 2