How tro obtain the absolute install path of a plugin? [message #253886] |
Fri, 18 June 2004 13:52 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: fabien.mairesse.barco.com
Hello,
I can't obtain the absolute install path of my plugin. I didn't find any
suitable methods in class Platform. I've tried
IPLuginDescriptor::getInstallURL() but the returned URL is :
"/plugin/my_plugin_directory/" (I don't understand this URL because my
plugins are stored in the "plugins/" directory of the platform and the URL
contains "plugin/" (without 's'). So this URL is even not the relative
path of my plugin in the platform?)
What I want to do is accessing directly to a resource stored in my plugin
directory.
thanks in advance
Fabien
|
|
|
|
Re: How tro obtain the absolute install path of a plugin? [message #253906 is a reply to message #253894] |
Fri, 18 June 2004 14:35 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: richkulp.NO.SPAM.us.ibm.com
But be aware you may not always get a file url. It is possible,
depending on how things are installed, that you could get a URL pointing
into a jar, or even a url that exists on another system.
However, the default is currently a local file. Most installations don't
have the plugins zipped into a jar nor do they install remote.
--
Thanks, Rich Kulp
|
|
|
Re: How tro obtain the absolute install path of a plugin? [message #253931 is a reply to message #253894] |
Fri, 18 June 2004 15:22 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: paull.NOSPAMcodetelligence.com
I use
getBundle().getEntry("/")
Paul
www.codetelligence.com
"Philipp Bouillon" <Philipp.Bouillon@t-online.de> wrote in message
news:causvq$amt$1@eclipse.org...
> Hi,
>
> there is a method in Platform called "resolve" which resolved the URL
> retrieved by getInstallURL. A call to ".getFile()" of the retrieved URL
> gives you the absolute path on your system---like this:
>
> String resolvedPath = Platform.resolve(<URL retrieved by
> PluginDescriptor.getInstallURL()>).getFile();
>
> Note however, that PluginDescriptor is deprecated in 3.0. I am not too
> sure about it, but I _think_ the correct way to determine the installation
> path of a plug-in in 3.0 is:
>
> private String getResolvedPath(String pluginID) {
> Bundle bundle = Platform.getBundle(pluginID);
> if (bundle != null) {
> URL bundleURL = bundle.getResource("/");
> if (bundleURL != null) {
> String resolvedPath;
> try {
> resolvedPath = Platform.resolve(bundleURL).getFile();
> return resolvedPath;
> } catch (IOException e) {
> }
> }
> }
> return null;
> }
>
> where "pluginID" is the id of your plug-in as defined in plugin.xml.
>
> Hope that helps,
> Philipp
>
> > Hello,
>
> > I can't obtain the absolute install path of my plugin. I didn't find any
> > suitable methods in class Platform. I've tried
> > IPLuginDescriptor::getInstallURL() but the returned URL is :
> > "/plugin/my_plugin_directory/" (I don't understand this URL because my
> > plugins are stored in the "plugins/" directory of the platform and the
URL
> > contains "plugin/" (without 's'). So this URL is even not the relative
> > path of my plugin in the platform?)
> > What I want to do is accessing directly to a resource stored in my
plugin
> > directory.
>
>
> > thanks in advance
> > Fabien
>
>
|
|
|
thank you! [message #253935 is a reply to message #253894] |
Fri, 18 June 2004 15:23 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: fabien.mairesse.barco.com
it works!! Thank you very much Philipp.
Philipp Bouillon wrote:
> Hi,
> there is a method in Platform called "resolve" which resolved the URL
> retrieved by getInstallURL. A call to ".getFile()" of the retrieved URL
> gives you the absolute path on your system---like this:
> String resolvedPath = Platform.resolve(<URL retrieved by
> PluginDescriptor.getInstallURL()>).getFile();
> Note however, that PluginDescriptor is deprecated in 3.0. I am not too
> sure about it, but I _think_ the correct way to determine the installation
> path of a plug-in in 3.0 is:
> private String getResolvedPath(String pluginID) {
> Bundle bundle = Platform.getBundle(pluginID);
> if (bundle != null) {
> URL bundleURL = bundle.getResource("/");
> if (bundleURL != null) {
> String resolvedPath;
> try {
> resolvedPath = Platform.resolve(bundleURL).getFile();
> return resolvedPath;
> } catch (IOException e) {
> }
> }
> }
> return null;
> }
> where "pluginID" is the id of your plug-in as defined in plugin.xml.
> Hope that helps,
> Philipp
> > Hello,
> > I can't obtain the absolute install path of my plugin. I didn't find any
> > suitable methods in class Platform. I've tried
> > IPLuginDescriptor::getInstallURL() but the returned URL is :
> > "/plugin/my_plugin_directory/" (I don't understand this URL because my
> > plugins are stored in the "plugins/" directory of the platform and the URL
> > contains "plugin/" (without 's'). So this URL is even not the relative
> > path of my plugin in the platform?)
> > What I want to do is accessing directly to a resource stored in my plugin
> > directory.
> > thanks in advance
> > Fabien
|
|
|
Powered by
FUDForum. Page generated in 0.04290 seconds