diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 7fee34d97..3844e39ec 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -1002,8 +1002,7 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g EventReset reset(writeEvent); // Will reset event in destructor. Buffer* buffer = getBufferByID(id); - bool isHidden = false; - bool isSys = false; + bool isHiddenOrSys = false; DWORD attrib = 0; TCHAR fullpath[MAX_PATH]; @@ -1019,13 +1018,9 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g if (attrib != INVALID_FILE_ATTRIBUTES) { - isHidden = (attrib & FILE_ATTRIBUTE_HIDDEN) != 0; - if (isHidden) - ::SetFileAttributes(filename, attrib & ~FILE_ATTRIBUTE_HIDDEN); - - isSys = (attrib & FILE_ATTRIBUTE_SYSTEM) != 0; - if (isSys) - ::SetFileAttributes(filename, attrib & ~FILE_ATTRIBUTE_SYSTEM); + isHiddenOrSys = (attrib & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) != 0; + if (isHiddenOrSys) + ::SetFileAttributes(filename, attrib & ~(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)); } } @@ -1088,11 +1083,8 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g return false; } - if (isHidden) - ::SetFileAttributes(fullpath, attrib | FILE_ATTRIBUTE_HIDDEN); - - if (isSys) - ::SetFileAttributes(fullpath, attrib | FILE_ATTRIBUTE_SYSTEM); + if (isHiddenOrSys) + ::SetFileAttributes(fullpath, attrib); if (isCopy) {