Common/FileSystem: Don't recompress already compressed files

This commit is contained in:
Connor McLaughlin 2022-04-24 02:05:40 +10:00 committed by refractionpcsx2
parent 77a7b18b29
commit 4543ddbcc2
1 changed files with 7 additions and 0 deletions

View File

@ -1190,6 +1190,13 @@ bool FileSystem::SetPathCompression(const char* path, bool enable)
if (attrs == INVALID_FILE_ATTRIBUTES)
return false;
const bool isCompressed = (attrs & FILE_ATTRIBUTE_COMPRESSED) != 0;
if (enable == isCompressed)
{
// already compressed/not compressed
return true;
}
const bool isFile = !(attrs & FILE_ATTRIBUTE_DIRECTORY);
const DWORD flags = isFile ? FILE_ATTRIBUTE_NORMAL : (FILE_FLAG_BACKUP_SEMANTICS | FILE_ATTRIBUTE_DIRECTORY);