[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: [JDT] IClassPathEntry to File System Absolute Path Question

Scott,

The following should do what you expect:

IFile jarFile =
ResourcesPlugin.getWorkspace().getRoot().getFile(classpathEntry.getPath());
return jarFile.getLocation().toOSString();

HTH,
Jerome

Scott Anderson wrote:
> 
> From a plugin I'm trying to retrieve all of a project's classpath entries
> and convert them to an absolute file system paths.  The problem I'm running
> into is with classpath entries that were added using Properties->Java Build
> Path->Add Jars... which adds a jar that is already contained within a
> workspace project to the path.  These particular entries are recorded with a
> path that looks like /ProjectName/jarname.jar and I can't figure out how to
> create the full file system path of the form
> <device>/<PathToWorkspace>/ProjectName/jarname.jar.
> 
> The two pieces of code I've tried have been the following:
> classpathEntry.getPath().makeAbsolute().toOSString();
> and
> JavaCore.getResolvedClasspathEntry(classpathEntry).getPath().makeAbsolute().
> toOSString();
> 
> Yet neither will add the device and workspace path prefixes to the path.  Is
> there a simple technique I'm missing?
> 
> Thanks in advance,
> Scott