java - Getting an absolute path on the local file system from an IResource -


what better approach absolute path on local file system iresource?

iresource res; ... res.getlocation().makeabsolute().tostring(); 

or

iresource res; ... new file(res.getlocationuri()).getabsolutepath(); 

(i skipped null checks in example.)

probably:

res.getlocation().toosstring(); 

the location should absolute no need call makeabsolute (although not cost when path absolute).

use toosstring() path in format used os (so \ on windows, / on mac, linux).

you can use toportablestring() standard format path useful data interchange not suitable use file.


Comments

Popular posts from this blog

c++ - Do gcc's __float128 floating point numbers take the current rounding mode into account? -

java - the value of local variable is not used -