Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » get file location using IFile and IProject
get file location using IFile and IProject [message #665103] Wed, 13 April 2011 09:30 Go to next message
Ani  is currently offline Ani Friend
Messages: 37
Registered: November 2010
Member
I'm trying to use IFile to get the location in file system at several places in my plugin project.

iFile.getLocation().toFile().getAbsolutePath();

at most of the places(mostly in editors) it returns me the correct path. but in the activator class, i'm getting strange result using the same.

e.g. i've a file at
D:\eclipse-SDK-helios\runtime-EclipseApplication\testIde\Web Content\forms\Form0.form

in my editor when i use IFile, i get the path correctly.
D:\eclipse-SDK-helios\runtime-EclipseApplication\testIde\WebContent\forms\Form0.form

In my activator class, I'm adding a resource change listener to the workspace, there if i try to use IFile to get the file path, i get the following ---
D:\eclipse-SDK-helios\runtime-EclipseApplication\testIde\testIde\WebContent\forms\Form0.form

here extra "textIde" gets added to the file path.

and if i try IProject.getFile().getLocation(), i get the following
D:\eclipse-SDK-helios\runtime-EclipseApplication\testIde\Form0.form

here the "WebContent/forms" folder is missing in the path

"testIde" is my test project in the runtime application.


Can anyone explain me this behaviour! or is it a bug?


thanks,
Re: get file location using IFile and IProject [message #665568 is a reply to message #665103] Fri, 15 April 2011 06:39 Go to previous message
Ani  is currently offline Ani Friend
Messages: 37
Registered: November 2010
Member
i solved it...the api returns path with repeated names some times...have to use IPath.removesegment() methods as per the need.
Previous Topic:Using commands in a view toolbar
Next Topic:Is there an example of pulldown behaviour of a command
Goto Forum:
  


Current Time: Tue Apr 23 15:47:08 GMT 2024

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

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

Back to the top