Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] IFile problem

> 
> public IFile fileToIFile() {
> 	 	File f = new File("F:/eclipse/workspace/abc/cct.c");
> 	 	String p = f.getAbsolutePath();
> 		IPath path = new Path(p);
> 	            IFile iFile =
> ResourcesPlugin.getWorkspace().getRoot().getFile(path);
> 	    
> 	    try {
> 			iFile.getContents();
> 		} catch (CoreException e) {
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		}
> 	    return iFile;
> 	  }
> 
> I am trying to get the IFile using the above way but every time i get the
> exception iFile does not exist.
> 
> Where iFile is actually supposed to be located. Please help.
> 

You mean IFile, it suppose to be in your workspace, try something like

IWorkspaceRoot.getFileForLocation();

or explore

IWorkspaceRoot.findFileForLocation();


>> ResourcesPlugin.getWorkspace().getRoot().getFile(path);

This  only return a handle.

> 
> Disclaimer: 
> 
> This message and any attachment(s) contained here are information that is
> confidential,proprietary to HCL Technologies and its customers, privileged
> or otherwise protected by law.The information is solely intended for the
> individual or the entity it is addressed to. If you are not the intended
> recipient of this message, you are not authorized to read, forward,
> print,retain, copy or disseminate this message or any part of it. If you
> have received this e-mail in error, please notify the sender immediately by
> return e-mail and delete it from your computer.
> 

hum ... this is a public mailing list.

I think I'm suppose to say something about using the newsgroup and other
appropriate mailing list, ... 8-)





Back to the top