From e38e3e8cb27c969aed970e2ae7d823d51c405a95 Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Fri, 1 Oct 2004 13:18:08 +0000 Subject: [PATCH] Fix for bug 178546 (regression: addFile (AppleSingle) doesn't work on Mac OS X ). r=dveditz, sr=jst. git-svn-id: svn://10.0.0.236/trunk@163077 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpinstall/src/ScheduledTasks.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mozilla/xpinstall/src/ScheduledTasks.cpp b/mozilla/xpinstall/src/ScheduledTasks.cpp index 7c884794cf5..8156cb9b4ea 100644 --- a/mozilla/xpinstall/src/ScheduledTasks.cpp +++ b/mozilla/xpinstall/src/ScheduledTasks.cpp @@ -237,7 +237,7 @@ PRInt32 ScheduleFileForDeletion(nsIFile *filename) PRInt32 ReplaceFileNow(nsIFile* aReplacementFile, nsIFile* aDoomedFile ) { - PRBool flagExists, flagIsEqual; + PRBool flagExists, flagRenamedDoomedFileExists, flagIsEqual; nsCOMPtr replacementFile; nsresult rv; @@ -262,8 +262,8 @@ PRInt32 ReplaceFileNow(nsIFile* aReplacementFile, nsIFile* aDoomedFile ) nsCOMPtr tmpLocalFile; aDoomedFile->Clone(getter_AddRefs(renamedDoomedFile)); - renamedDoomedFile->Exists(&flagExists); - if ( flagExists ) + renamedDoomedFile->Exists(&flagRenamedDoomedFileExists); + if ( flagRenamedDoomedFileExists ) { #ifdef XP_MACOSX // If we clone an nsIFile, and move the clone, the FSRef of the *original* @@ -370,9 +370,12 @@ PRInt32 ReplaceFileNow(nsIFile* aReplacementFile, nsIFile* aDoomedFile ) if (NS_SUCCEEDED(rv)) { - // we replaced the old file OK, now we have to - // get rid of it if it was renamed out of the way - result = DeleteFileNowOrSchedule( renamedDoomedFile ); + if (flagRenamedDoomedFileExists) + { + // we replaced the old file OK, now we have to + // get rid of it if it was renamed out of the way + result = DeleteFileNowOrSchedule( renamedDoomedFile ); + } } else {