Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to access files within an exported project
How to access files within an exported project [message #487171] Tue, 22 September 2009 06:07 Go to next message
Eclipse UserFriend
Hi,
in my application i need to access a configuration files e.g. "config/user.xml" to read and write the user settings.
while running the application in eclipse i can access the files using
Platform.getBundle("my.plugin.id").getEntry("/")

to find the plugin's root directory.

after exporting the project as a standalone application that doesn't work anymore since everything is bundled in the plugin's jar file.
How do you access files in your standalone RCP application?
regards, matthias
Re: How to access files within an exported project [message #487272 is a reply to message #487171] Tue, 22 September 2009 11:52 Go to previous messageGo to next message
Eclipse UserFriend
Did you bundle the files? Check the options in 'Build' page of your
manifest.
Re: How to access files within an exported project [message #487278 is a reply to message #487171] Tue, 22 September 2009 12:13 Go to previous messageGo to next message
Eclipse UserFriend
Matthias,

you can use org.eclipse.core.runtime.FileLocator#openStream(Bundle
bundle, IPath file, boolean substituteArgs)

Tom

matthias schrieb:
> Hi,
> in my application i need to access a configuration files e.g.
> "config/user.xml" to read and write the user settings.
> while running the application in eclipse i can access the files using
> Platform.getBundle("my.plugin.id").getEntry("/")
> to find the plugin's root directory.
>
> after exporting the project as a standalone application that doesn't
> work anymore since everything is bundled in the plugin's jar file.
> How do you access files in your standalone RCP application?
> regards, matthias
Re: How to access files within an exported project [message #487414 is a reply to message #487278] Wed, 23 September 2009 03:38 Go to previous message
Eclipse UserFriend
hi, thanks to both of you,
with FileLocator.openStream() it worked
one more question, as mention above i need to write back the user settings to that file. how can i manage that, since afaik the file is located in the plugin.jar
or is there better approach?
Previous Topic:How to get action for main menu item?
Next Topic:Check dirty file
Goto Forum:
  


Current Time: Mon Jun 16 03:59:18 EDT 2025

Powered by FUDForum. Page generated in 0.04857 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top