relative path inside a plugin [message #326471] |
Thu, 20 March 2008 08:49  |
Eclipse User |
|
|
|
Originally posted by: zhuj.in.tum.de
Hi everyone,
this is actually a repost from the eclipse.pde. sorry for this, but I'm
really eager to get the answer.
I have a question about "how to specify 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 on
differnt machines.
So my question: How should I access this ont.owl inside P1, using a
relative path.
any idea how to achieve this?
best regards!
Jinhui
|
|
|
|
|
Re: relative path inside a plugin [message #326504 is a reply to message #326502] |
Fri, 21 March 2008 04:00  |
Eclipse User |
|
|
|
Originally posted by: massimiliano.fanciulli.intecs.it
Ops, i have made a mistake. Below the correct statement:
Massimiliano Fanciulli wrote:
> Hi Jinhui,
>
> you can use the following piece of code:
>
> Bundle plugin;
> URL entry;
> InputStream stream;
>
> plugin=Platform.getBundle(<PLUGIN_ID>);
> entry=plugin.getEntry(<RELATIVE_PATH_TO_FILE>);
>
> stream=url.openStream();
>
stream=entry.openStream();
Regards,
Massimiliano
> I hope this could help you.
> Regards,
> Massimiliano Fanciulli
>
> Jinhui wrote:
>> Hi everyone,
>> this is actually a repost from the eclipse.pde. sorry for this, but
>> I'm really eager to get the answer.
>>
>>
>> I have a question about "how to specify 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
>> on differnt machines.
>>
>>
>> So my question: How should I access this ont.owl inside P1, using a
>> relative path.
>> any idea how to achieve this?
>>
>> best regards!
>> Jinhui
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04128 seconds