From ea32eb222e5a46aa6386faeed2a173cac1173def Mon Sep 17 00:00:00 2001 From: "bnesse%netscape.com" Date: Fri, 23 Aug 2002 18:36:03 +0000 Subject: [PATCH] Backing myself out to see if this caused btek to go orange. --- modules/libpref/src/nsSafeSaveFile.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/libpref/src/nsSafeSaveFile.cpp b/modules/libpref/src/nsSafeSaveFile.cpp index 3ff30a3f7379..e0182826e433 100644 --- a/modules/libpref/src/nsSafeSaveFile.cpp +++ b/modules/libpref/src/nsSafeSaveFile.cpp @@ -94,8 +94,9 @@ nsSafeSaveFile::~nsSafeSaveFile(void) nsresult nsSafeSaveFile::CreateBackup(PurgeBackupType aPurgeType) { - nsresult rv, rv2; - PRBool bExists; + nsCOMPtr backupParent; + nsresult rv, rv2; + PRBool bExists; // if the target file doesn't exist there is nothing to backup if (!mTargetFileExists) @@ -109,10 +110,15 @@ nsresult nsSafeSaveFile::CreateBackup(PurgeBackupType aPurgeType) return rv; } + // Ugh, copy only takes a directory and a name, lets "unpackage" our target file... + rv = mBackupFile->GetParent(getter_AddRefs(backupParent)); + if (NS_FAILED(rv)) + return rv; + // and finally, copy the file (preserves file permissions) rv2 = NS_OK; do { - rv = mTargetFile->CopyToNative(nsnull, mBackupFileName); + rv = mTargetFile->CopyToNative(backupParent, mBackupFileName); if (NS_SUCCEEDED(rv)) break;