diff --git a/src/io/physicalfilestream.cpp b/src/io/physicalfilestream.cpp index 6a0dbda5..823bc8c1 100644 --- a/src/io/physicalfilestream.cpp +++ b/src/io/physicalfilestream.cpp @@ -16,9 +16,11 @@ std::ios_base::openmode PhysicalFileStream::PrepareFileOpenMode( return {}; } - bool writeNoExistNoCreate = - (flags & WRITE) && !fileExists && !(flags & CREATE_IF_NOT_EXISTS); - bool readNoExist = !(flags & WRITE) && (flags & READ) && !fileExists; + bool writeNoExistNoCreate = (flags & WRITE) && + (fileExists == IoError_NotFound) && + !(flags & CREATE_IF_NOT_EXISTS); + bool readNoExist = + !(flags & WRITE) && (flags & READ) && (fileExists == IoError_NotFound); if (writeNoExistNoCreate || readNoExist) { ErrorCode = IoError_NotFound; std::string errMsg =