Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to get full path of a Project Resource
How to get full path of a Project Resource [message #292207] Fri, 30 September 2005 15:41 Go to next message
Eclipse UserFriend
In our Eclipse plug-in, I need to copy a file within a workspace to a
directory path (for example C:\TEMP"). I have an IResource object that
represents the file I want to copy, but if I use the .fullPath() method,
it only gives me the path starting at the project folder within the
workspace. If my workspace is at "C:\eclipse\myWorkspace", how do I get
the rest of this path information from within Eclipse.

Another option I thought might be to use the IResource.copy() method, but
my destination path is a String and the destination parameter is an IPath.

Please email me with your answers.

Thanks a bunch!
Curt
Re: How to get full path of a Project Resource [message #292208 is a reply to message #292207] Fri, 30 September 2005 15:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Curt Schwaderer" <curt.schwaderer@ipfabrics.com> wrote in message
news:3c7ba4785335f37ab63a177f9bd419d2$1@www.eclipse.org...
> In our Eclipse plug-in, I need to copy a file within a workspace to a
> directory path (for example C:\TEMP"). I have an IResource object that
> represents the file I want to copy, but if I use the .fullPath() method,
> it only gives me the path starting at the project folder within the
> workspace. If my workspace is at "C:\eclipse\myWorkspace", how do I get
> the rest of this path information from within Eclipse.
>
Did you check the javadoc for IResource?

---
Sunil
Re: How to get full path of a Project Resource [message #292209 is a reply to message #292208] Fri, 30 September 2005 16:04 Go to previous messageGo to next message
Eclipse UserFriend
Yes, I looked at the Javadoc for IResource and the only things available
look like the copy() method possibly. The fullPath doesn't give you the
complete path - just relative to the Workspace. So, that hasn't been any
help.
Re: How to get full path of a Project Resource [message #292210 is a reply to message #292209] Fri, 30 September 2005 16:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Curt Schwaderer" <curt.schwaderer@ipfabrics.com> wrote in message
news:31e72da7cab1f08ad20f25e179a3af42$1@www.eclipse.org...
> Yes, I looked at the Javadoc for IResource and the only things available
> look like the copy() method possibly. The fullPath doesn't give you the
> complete path - just relative to the Workspace. So, that hasn't been any
> help.
>

How about getLocation()?
Is that of any help?
---
Sunil
Re: How to get full path of a Project Resource [message #292219 is a reply to message #292207] Sat, 01 October 2005 17:56 Go to previous messageGo to next message
Eclipse UserFriend
Platform.resolve(URL url_to_file) should return the actual file system
path to your file.

Cheers
Marc

Curt Schwaderer wrote:
> In our Eclipse plug-in, I need to copy a file within a workspace to a
> directory path (for example C:\TEMP"). I have an IResource object that
> represents the file I want to copy, but if I use the .fullPath() method,
> it only gives me the path starting at the project folder within the
> workspace. If my workspace is at "C:\eclipse\myWorkspace", how do I get
> the rest of this path information from within Eclipse.
>
> Another option I thought might be to use the IResource.copy() method,
> but my destination path is a String and the destination parameter is an
> IPath.
>
> Please email me with your answers.
>
> Thanks a bunch!
> Curt
>
>
Re: How to get full path of a Project Resource [message #292236 is a reply to message #292207] Mon, 03 October 2005 09:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Curt Schwaderer wrote:
> In our Eclipse plug-in, I need to copy a file within a workspace to a
> directory path (for example C:\TEMP"). I have an IResource object that
> represents the file I want to copy, but if I use the .fullPath() method,
> it only gives me the path starting at the project folder within the
> workspace. If my workspace is at "C:\eclipse\myWorkspace", how do I get
> the rest of this path information from within Eclipse.
>
> Another option I thought might be to use the IResource.copy() method,
> but my destination path is a String and the destination parameter is an
> IPath.
>
> Please email me with your answers.
>
> Thanks a bunch!
> Curt
>
>

what i do is

get workspace location
append project location
append file location

make sure you get the raw paths. if you dont, you will not get the
proper path for linked resources.

CL
Re: How to get full path of a Project Resource [message #292242 is a reply to message #292236] Mon, 03 October 2005 12:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: john.eclipsefaq.org

CL [dnoyeb] Gilbert wrote:
> what i do is
>
> get workspace location
> append project location
> append file location
>
> make sure you get the raw paths. if you dont, you will not get the
> proper path for linked resources.

This isn't correct in the case where the project is not stored in the
default location. A project can be stored anywhere in the file system
outside the workspace location. IResource.getLocation() is the correct
API to use.
--
Re: How to get full path of a Project Resource [message #292292 is a reply to message #292242] Tue, 04 October 2005 09:42 Go to previous message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

John Arthorne wrote:
>
>
> CL [dnoyeb] Gilbert wrote:
>
>> what i do is
>>
>> get workspace location
>> append project location
>> append file location
>>
>> make sure you get the raw paths. if you dont, you will not get the
>> proper path for linked resources.
>
>
> This isn't correct in the case where the project is not stored in the
> default location. A project can be stored anywhere in the file system
> outside the workspace location. IResource.getLocation() is the correct
> API to use.
> --

if you are after the output folder of the project Its not really a
resource, so in that case it was necessary to create the location
through appending paths.

getOutputLocation
getWorkspace.getRoot

IFolder = root.getFolder(outputLocation)
IFolder.getRawLocation



CL
Previous Topic:Applying a stylesheet to help html
Next Topic:Is there any easy way to deploy the customer patch file?
Goto Forum:
  


Current Time: Sat Sep 13 23:47:49 EDT 2025

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

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

Back to the top