Skip to content

Commit

Permalink
Fix the exists check
Browse files Browse the repository at this point in the history
  • Loading branch information
Dextinfire committed Oct 5, 2024
1 parent 231cf55 commit 26c14b7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/io/physicalfilestream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 26c14b7

Please sign in to comment.