Fix for bug 164190. nsSafeSaveFile mistreats nsLocalFile, deleting files under one. Patch by sfraser, r=ccarlen, sr=alecf.
git-svn-id: svn://10.0.0.236/trunk@127957 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
e336223fa6
commit
dae532403b
@ -94,9 +94,8 @@ nsSafeSaveFile::~nsSafeSaveFile(void)
|
||||
|
||||
nsresult nsSafeSaveFile::CreateBackup(PurgeBackupType aPurgeType)
|
||||
{
|
||||
nsCOMPtr<nsIFile> backupParent;
|
||||
nsresult rv, rv2;
|
||||
PRBool bExists;
|
||||
nsresult rv, rv2;
|
||||
PRBool bExists;
|
||||
|
||||
// if the target file doesn't exist there is nothing to backup
|
||||
if (!mTargetFileExists)
|
||||
@ -110,15 +109,10 @@ 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(backupParent, mBackupFileName);
|
||||
rv = mTargetFile->CopyToNative(nsnull, mBackupFileName);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
break;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user