diff --git a/include/Nazara/Core/Enums.hpp b/include/Nazara/Core/Enums.hpp index 0c0530489..02039811b 100644 --- a/include/Nazara/Core/Enums.hpp +++ b/include/Nazara/Core/Enums.hpp @@ -79,7 +79,8 @@ namespace Nz OpenMode_Append = 0x01, // Disable writing on existing parts and put the cursor at the end OpenMode_Lock = 0x02, // Disable modifying the file before it is open - OpenMode_ReadOnly = 0x04, // Open in read only + OpenMode_MustExit = 0x04, // Fail if the file doesn't exists, even if opened in write mode + OpenMode_ReadOnly = 0x08, // Open in read only OpenMode_Text = 0x10, // Open in text mod OpenMode_Truncate = 0x20, // Create the file if it doesn't exist and empty it if it exists OpenMode_WriteOnly = 0x40, // Open in write only, create the file if it doesn't exist @@ -105,7 +106,8 @@ namespace Nz enum Plugin { Plugin_Assimp, - Plugin_FreeType + + Plugin_Count }; enum PrimitiveType diff --git a/src/Nazara/Core/Win32/FileImpl.cpp b/src/Nazara/Core/Win32/FileImpl.cpp index 8c479c798..688b87c99 100644 --- a/src/Nazara/Core/Win32/FileImpl.cpp +++ b/src/Nazara/Core/Win32/FileImpl.cpp @@ -64,7 +64,7 @@ namespace Nz { access |= GENERIC_READ; - if ((mode & OpenMode_WriteOnly) == 0) + if (mode & OpenMode_MustExit || (mode & OpenMode_WriteOnly) == 0) openMode |= OPEN_EXISTING; } @@ -77,6 +77,8 @@ namespace Nz if (mode & OpenMode_Truncate) openMode |= CREATE_ALWAYS; + else if (mode & OpenMode_MustExit) + openMode |= OPEN_EXISTING; else openMode |= OPEN_ALWAYS; }