Fix for bug 178546 (regression: addFile (AppleSingle) doesn't work on Mac OS X ). r=dveditz, sr=jst.

This commit is contained in:
peterv%propagandism.org 2004-10-01 13:18:08 +00:00
parent 5009ca4eb7
commit 2116663b00

View File

@ -237,7 +237,7 @@ PRInt32 ScheduleFileForDeletion(nsIFile *filename)
PRInt32 ReplaceFileNow(nsIFile* aReplacementFile, nsIFile* aDoomedFile )
{
PRBool flagExists, flagIsEqual;
PRBool flagExists, flagRenamedDoomedFileExists, flagIsEqual;
nsCOMPtr<nsIFile> replacementFile;
nsresult rv;
@ -262,8 +262,8 @@ PRInt32 ReplaceFileNow(nsIFile* aReplacementFile, nsIFile* aDoomedFile )
nsCOMPtr<nsILocalFile> 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
{