Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » problem in --> IFile org.eclipse.core.resources.IProject.getFile(String name)
problem in --> IFile org.eclipse.core.resources.IProject.getFile(String name) [message #333752] Fri, 02 January 2009 10:28 Go to next message
Anand Kumar Gupta is currently offline Anand Kumar GuptaFriend
Messages: 14
Registered: July 2009
Junior Member
I am doing following operation:
(Absolute path of my file : C:\100_test\Untitled_confdata.xml)

String projectName = "Local";
IWorkspace ws = ResourcesPlugin.getWorkspace();
IProject project = ws.getRoot().getProject(projectName.toLowerCase());
File tempFile = new File(filePath);
//filePath is getting passed by another method

IFile file = project.getFile(tempFile.getCanonicalPath());

//this file is coming like-(1)-> L/local/100_test/Untitled_confdata.xml
//but it should come like
this-(2)->L/local/CF/100_test/Untitled_confdata.xml


Please tell me how would i get the file like the 2nd.....
Re: problem in --> IFile org.eclipse.core.resources.IProject.getFile(String name) [message #333753 is a reply to message #333752] Fri, 02 January 2009 11:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33254
Registered: July 2009
Senior Member
Anand,

The only method for mapping a file system path to an IFile is
IWorkspaceRoot.findFilesForLocation. Don't assume that anything File in
the file system will necessarily correspond to an IFile in the workspace
though...


Anand Kumar Gupta wrote:
> I am doing following operation:
> (Absolute path of my file : C:\100_test\Untitled_confdata.xml)
>
> String projectName = "Local";
> IWorkspace ws = ResourcesPlugin.getWorkspace();
> IProject project = ws.getRoot().getProject(projectName.toLowerCase());
> File tempFile = new File(filePath);
> //filePath is getting passed by another method
>
> IFile file = project.getFile(tempFile.getCanonicalPath());
>
> //this file is coming like-(1)-> L/local/100_test/Untitled_confdata.xml
> //but it should come like
> this-(2)->L/local/C�F/100_test/Untitled_confdata.xml
>
>
> Please tell me how would i get the file like the 2nd.....
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EclipseApplication Launcher Variant
Next Topic:Ignored reentrant call while viewer is busy
Goto Forum:
  


Current Time: Thu Nov 14 08:08:17 GMT 2024

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

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

Back to the top