Closed
Bug 70722
Opened 25 years ago
Closed 23 years ago
nsILocalFile needs a recursive copy [PATCH]
Categories
(Core :: XPCOM, enhancement, P3)
Tracking
()
RESOLVED
FIXED
mozilla1.0.1
People
(Reporter: pete, Assigned: pete)
Details
Attachments
(7 files)
|
6.65 KB,
patch
|
Details | Diff | Splinter Review | |
|
492 bytes,
text/plain
|
Details | |
|
6.67 KB,
patch
|
Details | Diff | Splinter Review | |
|
6.68 KB,
patch
|
Details | Diff | Splinter Review | |
|
19.46 KB,
patch
|
Details | Diff | Splinter Review | |
|
10.77 KB,
patch
|
Details | Diff | Splinter Review | |
|
10.73 KB,
patch
|
Details | Diff | Splinter Review |
nsILocalFile needs a recursive copy
--pete
Updated•25 years ago
|
Target Milestone: --- → Future
Comment 1•25 years ago
|
||
Is this a request for a feature? We need more information otherwise I am going
to mark this invalid.
OS: other → Linux
Hardware: Other → All
Target Milestone: Future → ---
| Assignee | ||
Comment 2•25 years ago
|
||
A request for inclusion suggested by Doug T in the new nsIFIle changes coming
down the mountain.
Mark invalid and i'll kick your but tough guy! ;-)
--pete
Comment 3•25 years ago
|
||
Marking NEW. :)
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: nsILocalFile needs a recursive copy → [RFE] nsILocalFile needs a recursive copy
Comment 4•25 years ago
|
||
...another feature request for your back-burner, Edward. DougT suggested it, if
he wants it ... perhaps he should write it :-) Consider re-assigning it to him.
Assignee: scc → kandrot
QA Contact: kandrot → scc
| Assignee | ||
Comment 5•25 years ago
|
||
To set the record straight, Doug didn't suggest it, I did . . .
I will be writing this shortly in as part of jslib work i am currently doing.
I may as well do a c++ implementation as well while i'm at it.
Assign this bug to me if you want.
--pete
Comment 6•25 years ago
|
||
Sounds like you have a handle on it. Reassigning as you requested. Thanks.
Assignee: kandrot → petejc
| Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → Future
| Assignee | ||
Comment 7•25 years ago
|
||
Changing email address
Assignee: petejc → petejc
Status: ASSIGNED → NEW
| Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 8•25 years ago
|
||
Yea, this is actually needed for moveTo to successfully move an entire dir and
it's contents across different logical devices. Right now we can't do this (on
unix anyway) . . .
libc "rename" only works on the same file system.
So moveTo would implement a recursive copy method and then delete the remaining
original files and dirs.
--pete
| Assignee | ||
Comment 9•25 years ago
|
||
I have copyToRecursive() now implemented on unix.
It will do a recursive copy across filesystems and can be used by moveTo() to
move files across filesystems.
I will have a first draft patch later today.
I will need help getting this tested on other platforms.
Thanks
--pete
| Assignee | ||
Comment 10•25 years ago
|
||
| Assignee | ||
Comment 11•25 years ago
|
||
| Assignee | ||
Comment 12•25 years ago
|
||
First draft of this implementation that is tested and working on unix is in
atachment #41838.
I'd appreciate some feedback for initial revisions. Pot holes etc .
Then after that, i can add implementations to the other platforms.
--pete
| Assignee | ||
Updated•25 years ago
|
Summary: [RFE] nsILocalFile needs a recursive copy → nsILocalFile needs a recursive copy [PATCH]
| Assignee | ||
Updated•25 years ago
|
| Assignee | ||
Comment 13•25 years ago
|
||
| Assignee | ||
Comment 14•25 years ago
|
||
one change i can see already is, the param "dir" doesn't need to be there.
it can be implemented in the CopySubDirContents method iteslf.
nsresult CopySubDirContents(nsIFile *newParent,
nsISimpleEnumerator *dir,
PRInt32 *indx,
nsISupportsArray **_retval);
--pete
| Assignee | ||
Comment 15•25 years ago
|
||
| Assignee | ||
Comment 16•25 years ago
|
||
Comment 17•25 years ago
|
||
Is nsIFile not one of the "frozen" interfaces? Should we really be making
changes to this interface?
| Assignee | ||
Comment 18•25 years ago
|
||
jst, even if it is forzen. Having an implementation for post 1.0 isn't a bad idea.
I will maintain the patch. Or are you suggesting create another interface for
new nsIFIle methods?
I'm scratching an itch here. ;-)
--pete
Comment 19•25 years ago
|
||
nsIFile is not frozen - in fact, it needs lots of work. We discussed this at an
arch meeting a long time ago but nothing was done. dougt wrote up what was
discussed and posted it on n.p.m.xpcom and porkjockeys. I think there were some
good plans.
As far as this patch goes, man, it's a lot of code. I made an implementation of
this here: http://lxr.mozilla.org/mozilla/source/profile/src/nsProfile.cpp#183
which I think does the same thing, is the same for all platforms, and is quite a
bit smaller. Hit me for putting it where I did.
| Assignee | ||
Comment 20•25 years ago
|
||
Thats alright Conrad, if implemented it in js i'm sure i would have ended up
with mush less code since thats a language i'm stronger at. I needed to do this.
I don't have the oportunity to implement things in c++ much.
I'll work on trimming it down. But a method like this is obviously needed.
So lets work on getting any implementation in!
--pete
| Assignee | ||
Comment 21•25 years ago
|
||
| Assignee | ||
Comment 22•25 years ago
|
||
Although,this code is still a bit fatter than Conrads, the reason being that we
only have one param and will try to do the right thing if the dest dir exists by
appending the leaf from the current nsIFile dir.
There is also a bit more error checking for dirs that are symlinks and checking
to make sure the src and dest are not equal etc . . .
So, i am curious to see if this compiles on the other platforms.
Thanks
--pete
| Assignee | ||
Comment 23•25 years ago
|
||
Comment 24•25 years ago
|
||
if (isDirectory) {
- // XXXbe what's the bugzilla.mozilla.org bug number for this?
- rv = NS_ERROR_NOT_IMPLEMENTED;
+ // XXXbe what's the bugzilla.mozilla.org bug number for this? bug=70722
--pete
+ rv = NS_ERROR_NOT_IMPLEMENTED; // CopyToRecursive(newParent) will be used
This comment isn't right. The real bug there is bug 53474. CopyTo is currently
implemented for directories (recursively) on all platforms except Unix :-(
The diference between CopyTo and RecursiveCopy should be that, with
RecursiveCopy, if the dest dir already exists, we should not append the leaf
name and create a child - we should copy the contents of the src dir into the
dest dir. If I want to copy a dir into a parent dir, I would just use CopyTo
(except that it doesn't work with dirs on Unix)
RecursiveCopy is useful instead of CopyTo when you have a dest dir with files in
it and you want to copy the contents of a src dir into that dir, leaving the
existing files in dest dir alone.
| Assignee | ||
Comment 25•25 years ago
|
||
Ok, so the implementation we have here is for copyTo to copy dirs recursively on
unix.
So i can pull this method out of "nsIFile.idl" and it should fix bug#53474.
Correct?
Then we can create a recursive copy method to add to nsIFile interface.
Doug? You own nsIFIle right?
Any comments.
I'll do what needs to be done. Lets just clarify things and get it done.
Thanks
--pete
| Assignee | ||
Updated•25 years ago
|
Priority: -- → P3
Target Milestone: Future → mozilla0.9.5
| Assignee | ||
Updated•25 years ago
|
Target Milestone: mozilla0.9.5 → mozilla1.0
Comment 26•24 years ago
|
||
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1
(you can query for this string to delete spam or retrieve the list of bugs I've
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Comment 27•23 years ago
|
||
Looks like the normal nsIFile::CopyTo method is recursive now (I checked win,
unix, mac implementations)
does this mean this bug can be closed?
| Assignee | ||
Comment 28•23 years ago
|
||
Yes this has been fixed in copyTo.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•