Bug 199473: Make downloads work if temporary directory is encrypted on Windows. r=jmathies

--HG--
extra : rebase_source : e88b316e071dd9bb8a57ab11e1bd13bc39d7d8eb
This commit is contained in:
Steve Harper 2010-05-23 10:48:21 -07:00
parent 7ab8f39d53
commit 9b9de75895

View File

@ -1470,10 +1470,23 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent,
copyOK = ::CopyFileW(filePath.get(), destPath.get(), PR_TRUE);
else {
#ifndef WINCE
copyOK = ::MoveFileExW(filePath.get(), destPath.get(),
MOVEFILE_REPLACE_EXISTING |
MOVEFILE_COPY_ALLOWED |
MOVEFILE_WRITE_THROUGH);
DWORD status;
if (FileEncryptionStatusW(filePath.get(), &status)
&& status == FILE_IS_ENCRYPTED)
{
copyOK = CopyFileExW(filePath.get(), destPath.get(), NULL, NULL, NULL,
COPY_FILE_ALLOW_DECRYPTED_DESTINATION);
if (copyOK)
DeleteFileW(filePath.get());
}
else
{
copyOK = ::MoveFileExW(filePath.get(), destPath.get(),
MOVEFILE_REPLACE_EXISTING |
MOVEFILE_COPY_ALLOWED |
MOVEFILE_WRITE_THROUGH);
}
#else
DeleteFile(destPath.get());
copyOK = :: MoveFileW(filePath.get(), destPath.get());