Closed
Bug 23664
Opened 25 years ago
Closed 25 years ago
Make RecursiveCopy of FileSpec behave uniformly on all platforms
Categories
(Core :: XPCOM, defect, P3)
Tracking
()
RESOLVED
WONTFIX
M15
People
(Reporter: racham, Assigned: dougt)
References
Details
At present, when I use RecursiveCopy (of nsFileSpec) for some of the operation
in my component (profile), it does different things o different platforms. Like,
while doing a RecursiveCopy, on windows if a file exists in destination
directoty the copy operation fails where as on Linux the file in the destination
directory gets overwritten. This behavior is stemmed from the CopyToDir function
which does things diffrently on different platforms.
Ideally we should have a flag passed to RecursiveCopy to overwrite or not the
files in the destination directory. We can even set the default value of the
flag to TRUE/FALSE which ever you think makes most sense.
I have a bug 14908 that requires to copy default profile files into the migrated
profile directory. This bug now depends on this feature to be in place. So,
making my bug dependent on this.
Assignee | ||
Updated•25 years ago
|
Target Milestone: M14
Assignee | ||
Comment 1•25 years ago
|
||
moving into the m14 bucket.
Hi Doug,
I have seen you marked the this bug's TFV to M15.
Though at this point I am using a hack to copy the required
files into the migrated profiles directory
(http://lxr.mozilla.org/seamonkey/source/profile/src/nsProfile.cpp#1209),
I think it is important to have RecursiveCopy routine with the ability we
talked about in the earlier bug reports. Right now the hack copies
the single non-4.x file (i.e., panels.rdf) into the migrated 5.0
profile directory. But if we decide to add any more files to
be added, then we need to add code to nsProfile.cpp as
opposed to dropping it in the dist/bin/defaults/profile. So,
please rethink about the TFV (to bring back to M14).
If you need help, please let me know. CopyToDir() routine,
I guees needs to take TRUE/FALSE params and do the right
thing at the right layer.
effect of the changes in a nutshell :
passing TRUE as parameter should let the routine to ovewrite while
doing the copy to the new dir.
passing FALSE as paramater should let the routine to skip the copying
existing files into the new dir.
Assignee | ||
Comment 4•25 years ago
|
||
rachamm I am not going to add or fix nsFileSpec. I will however work on
nsFile. Maybe you should think about moving to new new interface?
shaver, blizzard, I think that we should add a new flag to nsIFile::copy and
nsIFile::move that would specify what we do when there is an existing file.
what are your thoughts?
I say we follow Fine Unix Tradition and make it an error. The calling code can
just call ->Delete() and retry if appropriate, rather than having code to do
just that in all our implementations.
Assignee | ||
Comment 6•25 years ago
|
||
it works for me. if a client like racham@netscape.com needs to do something
special, they can iterate themselves.
Assignee | ||
Comment 7•25 years ago
|
||
sorry for sounding arrogant above.
racham, using nsIFile, you can do something like this:
1. Call GetDirectoryEntries()
2. Use that nsISimpleEnumerator to run over the children
3. If it is a file, try to copy to the destination. (you will have to keep
track of the relative offset in the dest by using GetPath())
4. If it is a directory, go to step 1.
5. When there are no more files or directories, unwind.
I hope this helps. Marking as wontfix.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•