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

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -