Copy files out of Plugins programmatically [message #319540] |
Fri, 24 August 2007 09:26 |
Eclipse User |
|
|
|
Originally posted by: stefan.bley.dd.gmx.de
Hello.
I try to copy files out of plugin bundles, but I don't come to a solution.
I get the Bundle:
Bundle b = Platform.getBundle(...);
Then I tried:
URL url = b.getResource("lib/aFile.jar"); // where lib/aFile.jar is the
file I want to copy
But what can I do with this URL? I cannot instantiate a java.io.File with
it. Is there any convenience class I did not see yet? How can I copy the
file?
Thanks in advance,
Stefan
|
|
|
Re: Copy files out of Plugins programmatically [message #319541 is a reply to message #319540] |
Fri, 24 August 2007 09:45 |
Eclipse User |
|
|
|
Originally posted by: dmsubs.NOSPAM.consertum.com
Look at FileLocator class.
--
Derek
Stefan Bley wrote:
> Hello.
> I try to copy files out of plugin bundles, but I don't come to a solution.
>
> I get the Bundle:
> Bundle b = Platform.getBundle(...);
>
> Then I tried:
> URL url = b.getResource("lib/aFile.jar"); // where lib/aFile.jar is the
> file I want to copy
>
> But what can I do with this URL? I cannot instantiate a java.io.File
> with it. Is there any convenience class I did not see yet? How can I
> copy the file?
>
> Thanks in advance,
> Stefan
>
|
|
|
Re: Copy files out of Plugins programmatically [message #319544 is a reply to message #319541] |
Fri, 24 August 2007 10:05 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Derek,
Yes, one could use toFileURI. That creates a copy in the file system,
so is not really the most efficient way. I'm not sure why Stefan
doesn't just use openStream on the URL to read directly from the jar and
then write those bytes to the target...
Derek Morris wrote:
> Look at FileLocator class.
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02759 seconds