[armedbear-devel] Idiomatic conversion of file: URLs to file-paths

Erik Huelsmann ehuels at gmail.com
Sun Dec 5 10:16:07 UTC 2010


Hi Mark,

To get back to our earlier (irc) discussion of converting
URL.getPath() / URI.getPath() to (Windows) pathnames:

I found this page:
http://weblogs.java.net/blog/2007/04/25/how-convert-javaneturl-javaiofile

which contains code on how to do the conversion. I just checked on
Windows it even strips the leading '/' which you get from
URL.getPath().


My reaction to these findings is to propose a new static function to
be added to the Utilities class, which should be used to convert
file:/ urls to paths. Our code should then be searched for invocations
of URL/URI.getPath() on file urls, changing it to the utility
function.


Regards,

Erik.




More information about the armedbear-devel mailing list