[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.pde] Re: how to access a file in Plugin at runtime
|
- From: laurent Goubet <laurent.goubet@xxxxxxx>
- Date: Thu, 20 Mar 2008 14:10:08 +0100
- Newsgroups: eclipse.pde
- Organization: Obeo
- User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)
Jinhui,
ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filepath)) can
do what you seek, with filepath being a String relative to the workspace
root (i.e. of the form '/' + pluginName + '/' + path).
An other option would be to use
Platform.getBundle(pluginID).getEntry(filepath) with filepath being a
path relative to the plugin root.
Cheers,
Laurent Goubet
Obeo
Jinhui a écrit :
Hi everyone,
I have a question about "how to resolve a relative path for a file in
the plugin".
the situation looks like the following:
I have a ontology file ont.owl in my Plugin P1. Now in some class of P1,
in order to access ont.owl, I used absolute paths. But this Path is
different on others' machine. And absolute path became problematic.
So my question: How can I access this ont.owl inside P1, using a
relative path, so that later, when the plugin gets exported, no
"FileNotFoundException" would be thrown.
any idea how to achieve this?
best regards!
Jinhui
begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:<a href="http://www.obeo.fr/">Obeo</a>
email;internet:laurent.goubet@xxxxxxx
url:http://www.obeo.fr
version:2.1
end:vcard