Core/File: Add OpenMode_MustExit

Former-commit-id: 1df10e230d3c6ef71244060845b1fc02f7b5a8e9
This commit is contained in:
Lynix 2016-04-27 18:10:45 +02:00
parent 0d6727e746
commit 78469266fd
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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;
}