Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » help:about IFile
help:about IFile [message #147212] Tue, 21 October 2003 08:52 Go to next message
Eclipse UserFriend
Originally posted by: tranfy.hotmail.com

In my project named com.software.vbrd ,there is a datasource.txt file in
the project root directory. I want to define a IFile object in order to
access the datasource.txt and get its absolute path which as a parameter
of the other java file ,and I write the following codes but it work wrong

IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IFile ifile = myWorkspaceRoot.getFile( new
Path("/com.software.vbrd/datasource.txt"));

String path = ifile.getFullPath().toOSString();
DataSourceList datasource = new DataSourceList(path);//path is a parameter
of the DataSourceList
try{
System.out.println(datasource.getDSNameList());
}catch(Exception e){
System.out.println(e.getMessage());
}
Re: help:about IFile [message #147220 is a reply to message #147212] Tue, 21 October 2003 09:05 Go to previous message
Eclipse UserFriend
Originally posted by: m.bauer.signsoft.com

The problem of your code is, that the path you recieve is a relative path.
You have to call IFile.getLocation() to get the absolute path.

Hth

Michael

"tranfy" <tranfy@hotmail.com> schrieb im Newsbeitrag
news:bn3a65$hkg$1@eclipse.org...
> In my project named com.software.vbrd ,there is a datasource.txt file in
> the project root directory. I want to define a IFile object in order to
> access the datasource.txt and get its absolute path which as a parameter
> of the other java file ,and I write the following codes but it work wrong
>
> IWorkspaceRoot myWorkspaceRoot =
ResourcesPlugin.getWorkspace().getRoot();
> IFile ifile = myWorkspaceRoot.getFile( new
> Path("/com.software.vbrd/datasource.txt"));
>
> String path = ifile.getFullPath().toOSString();
> DataSourceList datasource = new DataSourceList(path);//path is a
parameter
> of the DataSourceList
> try{
> System.out.println(datasource.getDSNameList());
> }catch(Exception e){
> System.out.println(e.getMessage());
> }
>
>
Previous Topic:cannot use url openstream with jre 1.3
Next Topic:problem with table refresh
Goto Forum:
  


Current Time: Sat May 10 10:05:04 EDT 2025

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

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

Back to the top