Seems I cannot rename directories with the moveTo function on Windows
(haven't tried other platforms), it copies the directory tree instead.
Renaming files works fine.  Here is sample code to repro via xpcshell.
Thought I would get comments before posting a bug report.
Thanks
Shane Caraveo
ActiveState


var file =
Components.classes["@mozilla.org/file/local;1"].createInstance(Components.in
terfaces.nsILocalFile);

// assumes test.txt exists already
// this WORKS
var fname = "c:\\temp\\test.txt";
var newfname = "c:\\temp\\test2.txt";

file.initWithUnicodePath(fname);
file.moveToUnicode(null, newfname);

// assumes that c:\temp\test directory exists already
// FAILES to rename directory, COPIES it instead, along with
files/subdirectories
var path = "c:\\temp\\test";
var newname = "c:\\temp\\testing";
file.initWithUnicodePath(path);
file.moveToUnicode(null, newname);





Reply via email to