Brodie Thiesfield wrote:
It would be worthwhile to specify this in the IDL files and to ensure that all of the implementations abide by the spec. What I've seen so far is that the Windows implementation at least (and so probably others too) isn't abiding by the spec. (ref GetParent).
If it is illegal to Append a path to an uninitialized nsIFile, then such an attemp should be spec'd to return an error of NS_ERROR_NOT_INITIALIZED.
Similarly the valid paths which can be set using InitWithPath needs to be better spelled out. i.e. Is any of the paths above valid.
I couldn't agree more. I've been trying to use a file:// URL with initWithPath(), which doesn't work. Furthermore, to my knowledge there is no function to convert from a file:// URL to a valid initWithPath argument. So far the best portable solution i've found is
var dirName = "file://c:/example/";
try
{
var obj_URI = Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURL);
obj_URI.spec = dirName;
var f = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
f.initWithPath(obj_URI.filePath.replace(/^\//,"").replace(/\//g,"\\"));
/*
do stuff here.
*/
}
catch (e)
{
alert(e);
}And this isn't guaranteed to work in future releases.
Note that if the only valid path is a fully described path, since AppendPath/AppendRelativePath are not permitting ".." it makes the role of Normalize() redundant.
Brodie
Good to see you around Brodie.
Nick _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
