[Jslib] Re: jslib check-ins and troubles

Martin Kutschker dreckskerl@glump.at
Sun, 17 Mar 2002 19:44:56 +0100


Martin Kutschker wrote:
> 
> I have also noticed (as prosted before) that urlToPath and chromeToPath 
> (fileUtils.js) are broken on Windows and probably on Mac as well. Please 
> folks, remember URL paths are NOT valid local paths on Windows and Mac!

I've found a fix for urlToPath:

Original code:

var FileURL=new  C.Constructor(JS_FILEUTILS_NETWORK_STD_CID, "nsIURL");
var fileURL=new FileURL();
fileURL.spec=aPath;
rv = fileURL.path;

My proposal:

var uri = C.classes[JS_FILEUTILS_NETWORK_STD_CID]
           .createInstance(JS_FILEUTILS_I_FILEURL);
uri.spec = aPath
rv = uri.file.path;

Masi