From 9ebc8ac9d352c0c7a206b27a32763ec76fb04ea9 Mon Sep 17 00:00:00 2001 From: "sfraser%netscape.com" Date: Fri, 23 Aug 2002 05:34:40 +0000 Subject: [PATCH] Part of fix for bug 163543 (prefs not saved between sessions): fix FSCopyObject to take a destination file name, and don't update the mFSRef of the nsLocalFile when making a copy. r=ccarlen/pinkerton. git-svn-id: svn://10.0.0.236/branches/CHIMERA_M1_0_1_BRANCH@127923 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsLocalFileOSX.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mozilla/xpcom/io/nsLocalFileOSX.cpp b/mozilla/xpcom/io/nsLocalFileOSX.cpp index fc15d4fe5cb..fd5c0a645b6 100644 --- a/mozilla/xpcom/io/nsLocalFileOSX.cpp +++ b/mozilla/xpcom/io/nsLocalFileOSX.cpp @@ -577,7 +577,7 @@ NS_IMETHODIMP nsLocalFile::Remove(PRBool recursive) err = ::FSDeleteContainer(&fsRef); else err = ::FSDeleteObject(&fsRef); - + return MacErrorMapper(err); } @@ -2023,11 +2023,10 @@ nsresult nsLocalFile::MoveCopy(nsIFile* aParentDir, const nsAString& newName, PR return rv; if (isCopy) { - err = ::FSCopyObject(&srcRef, &destRef, 0, kFSCatInfoNone, false, false, nsnull, nsnull, &newRef); - if (err == noErr && !newName.IsEmpty()) - err = ::FSRenameUnicode(&newRef, newName.Length(), PromiseFlatString(newName).get(), kTextEncodingUnknown, &newRef); - if (err == noErr) - mFSRef = newRef; + err = ::FSCopyObject(&srcRef, &destRef, + newName.Length(), newName.Length() ? PromiseFlatString(newName).get() : nsnull, + 0, kFSCatInfoNone, false, false, nsnull, nsnull, &newRef); + // don't update mFSRef on a copy } else { // First, try the quick way which works only within the same volume @@ -2037,9 +2036,10 @@ nsresult nsLocalFile::MoveCopy(nsIFile* aParentDir, const nsAString& newName, PR if (err == diffVolErr) { // If on different volumes, resort to copy & delete - err = ::FSCopyObject(&srcRef, &destRef, 0, kFSCatInfoNone, false, false, nsnull, nsnull, &newRef); - if (err == noErr && !newName.IsEmpty()) - err = ::FSRenameUnicode(&newRef, newName.Length(), PromiseFlatString(newName).get(), kTextEncodingUnknown, &newRef); + err = ::FSCopyObject(&srcRef, &destRef, + newName.Length(), newName.Length() ? PromiseFlatString(newName).get() : nsnull, + 0, kFSCatInfoNone, false, false, nsnull, nsnull, &newRef); + if (err == noErr) mFSRef = newRef; err = ::FSDeleteObjects(&srcRef);