Skip to main content



      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 05:28 Go to next message
Eclipse UserFriend
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 06:42 Go to previous message
Eclipse UserFriend
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.....
>
Previous Topic:EclipseApplication Launcher Variant
Next Topic:Ignored reentrant call while viewer is busy
Goto Forum:
  


Current Time: Tue Apr 29 02:49:18 EDT 2025

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

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

Back to the top