Closed
Bug 101527
Opened 23 years ago
Closed 23 years ago
moveTo function on windows doesn't remove old directory (works on mac, linux)
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.0
People
(Reporter: dougt, Assigned: sspitzer)
References
Details
(Whiteboard: [fixed on both branch and trunk])
Attachments
(2 files, 3 obsolete files)
284 bytes,
text/plain
|
Details | |
917 bytes,
patch
|
dougt
:
review+
Bienvenu
:
superreview+
asa
:
approval+
|
Details | Diff | Splinter Review |
Shane Caraveo wrote:
> 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);
It's a bug. If newParentDir is null and newName is non-null, it's supposed to be
renamed in place whether it's a file or a dir. The Mac impl does that and I'm
pretty sure the Unix impl does that. So, I think the Windows impl should be
fixed and the comment in the .idl should be clarified.
Comment 1•23 years ago
|
||
Yes, moveTo works fine on unix. Even across logical drives. ;-)
--pete
Reporter | ||
Updated•23 years ago
|
Target Milestone: --- → mozilla0.9.7
Reporter | ||
Comment 2•23 years ago
|
||
no fire under my feet for this. sorry.
Keywords: helpwanted
Target Milestone: mozilla0.9.7 → Future
Comment 3•23 years ago
|
||
Assign it to me Doug. I'll try to get to it for 0.9.7.
The only problem i have is I don't own a windows box.
Anyone want to donate or even lend me a box.
;-)
--pete
Comment 4•23 years ago
|
||
The description above is not exactly the behavior I'm seeing. I've got a recent
build (Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.9+)
Gecko/20020307) on Win2000.
When I move a directory, the old directory structure stays, but all files are
moved. So the final effect is that the dir is copied to a new name, and all
files are removed from the original.
I'll attach a test file for xpcshell (the sample code above doesn't work for me)
to show what I did.
-Luke
Comment 5•23 years ago
|
||
This is a short test for moving (renaming) a directory.
It's meant to be fed to xpcshell like
xpcshell> load("test.js");
Comment 6•23 years ago
|
||
What if you don't use the Unicode API's?
Does it work then or same thing?
I'll take this since i now have a windows box.
--pete
Assignee: dougt → petejc
Updated•23 years ago
|
Status: NEW → ASSIGNED
Comment 7•23 years ago
|
||
this is a trivial patch that adds a remove() after copying all the contents of
a directory. so it gets rid of the empty source directory.
on my windows box this makes MoveTo do what it's supposed to.
- Luke
Assignee | ||
Comment 8•23 years ago
|
||
this MoveTo() bug is blocking an adt1 bug (#137886)
I'll test and drive Luke's patch in.
Assignee | ||
Comment 9•23 years ago
|
||
similar patch to what luke provided, just up to date.
this fixes the problem for me.
Attachment #73592 -
Attachment is obsolete: true
Assignee | ||
Comment 10•23 years ago
|
||
taking, and moving in, since I have an immediate need for this.
Assignee: petejc → sspitzer
Status: ASSIGNED → NEW
Target Milestone: Future → mozilla1.0
Assignee | ||
Comment 11•23 years ago
|
||
accepting.
Status: NEW → ASSIGNED
Keywords: helpwanted
Summary: cannot rename directories with the moveTo function on Windows → moveTo function on windows doesn't remove old directory (works on mac, linux)
Assignee | ||
Comment 12•23 years ago
|
||
Attachment #80914 -
Attachment is obsolete: true
Comment 13•23 years ago
|
||
this looks like we remove the source in both the move and copy cases, if I'm
reading the diff correctly. Shouldn't we be checking move?
Assignee | ||
Comment 14•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Attachment #80959 -
Attachment is obsolete: true
Comment 15•23 years ago
|
||
Comment on attachment 80966 [details] [diff] [review]
whoops, only do the remove on move, thanks bienvenu
sr=bienvenu
Attachment #80966 -
Flags: superreview+
Reporter | ||
Comment 16•23 years ago
|
||
Comment on attachment 80966 [details] [diff] [review]
whoops, only do the remove on move, thanks bienvenu
r=dougt
Attachment #80966 -
Flags: review+
Assignee | ||
Comment 17•23 years ago
|
||
fixed on the trunk. I'll seek driver approval for the branch.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 18•23 years ago
|
||
Comment on attachment 80966 [details] [diff] [review]
whoops, only do the remove on move, thanks bienvenu
a=asa (on behalf of drivers) for checkin to the 1.0 branch
Attachment #80966 -
Flags: approval+
Assignee | ||
Comment 19•23 years ago
|
||
fixed on both branch and trunk.
Whiteboard: [fixed on both branch and trunk]
Comment 20•23 years ago
|
||
adding fixed1.0.0 keyword (branch resolution). This bug has comments saying it
was fixed on the 1.0 branch and a bonsai checkin comment that agrees. To verify
the bug has been fixed on the 1.0 branch please replace the fixed1.0.0 keyword
with verified1.0.0.
Keywords: fixed1.0.0
You need to log in
before you can comment on or make changes to this bug.
Description
•