File for Plugin at installation time [message #300101] |
Thu, 02 March 2006 05:25  |
Eclipse User |
|
|
|
Originally posted by: the.dodger.gmail.com
Hi all.
I'm developing a plugin for eclipse. It keeps data in its working
directory under the workspace .metadata\.plugins subdirectory. As example,
it uses the file:
<workspace>\.metadata\.plugins\com.test.example\data.dat
Inside the plugin, I can write and read the file using the function:
private File getDataFile(){
IPath path = ExamplePlugin.getDefault().getStateLocation();
path = path.append("data.dat");
return path.toFile();
}
All of this works fine.
Now, I'm developing a local eclipse-site for the installation of the
plugin. And I need copy a first "data.dat" file into the path
"<workspace>\.metadata\.plugins\com.test.example\" at installation time.
Is it possible? How can I copy a file in the working directory of a plugin?
Help me, please, I'm stuck with this :(
Thxs in advance
-dodger-
|
|
|
Re: File for Plugin at installation time [message #300110 is a reply to message #300101] |
Thu, 02 March 2006 07:41  |
Eclipse User |
|
|
|
Put your default data.dat as a resource in your plugin somewhere. When
you get your File, check to see if it exists. If it does, use it. If
it doesn't, then copy the resource version of data.dat out of the
classpath and into the File.
Later,
PW
|
|
|
Powered by
FUDForum. Page generated in 0.23587 seconds