mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fix File OpenOrCreate
This commit is contained in:
parent
3a1c0a3452
commit
a71962a5a8
6 changed files with 14 additions and 3 deletions
|
@ -178,7 +178,7 @@ namespace System.IO
|
|||
case .Open:
|
||||
createKind = .OpenExisting;
|
||||
case .OpenOrCreate:
|
||||
createKind = .CreateAlways;
|
||||
createKind = .OpenAlways;
|
||||
case .Truncate:
|
||||
createKind = .CreateAlways;
|
||||
createFlags |= .Truncate;
|
||||
|
@ -337,7 +337,7 @@ namespace System.IO
|
|||
case .Open:
|
||||
createKind = .OpenExisting;
|
||||
case .OpenOrCreate:
|
||||
createKind = .CreateAlways;
|
||||
createKind = .OpenAlways;
|
||||
case .Truncate:
|
||||
createKind = .CreateAlways;
|
||||
createFlags |= .Truncate;
|
||||
|
|
|
@ -271,6 +271,7 @@ namespace System
|
|||
CreateAlways,
|
||||
CreateIfNotExists,
|
||||
OpenExisting,
|
||||
OpenAlways,
|
||||
};
|
||||
|
||||
public enum BfpFileCreateFlags : int32
|
||||
|
|
|
@ -344,6 +344,7 @@ enum BfpFileCreateKind
|
|||
BfpFileCreateKind_CreateAlways,
|
||||
BfpFileCreateKind_CreateIfNotExists,
|
||||
BfpFileCreateKind_OpenExisting,
|
||||
BfpFileCreateKind_OpenAlways
|
||||
};
|
||||
|
||||
enum BfpFileCreateFlags
|
||||
|
|
|
@ -1858,6 +1858,10 @@ BFP_EXPORT BfpFile* BFP_CALLTYPE BfpFile_Create(const char* inName, BfpFileCreat
|
|||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
// POSIX doesn't need the OpenAlways kind.
|
||||
if (createKind == BfpFileCreateKind_OpenAlways)
|
||||
createKind = BfpFileCreateKind_CreateAlways;
|
||||
|
||||
BfpFile* bfpFile = NULL;
|
||||
|
||||
|
|
|
@ -2741,9 +2741,13 @@ BFP_EXPORT BfpFile* BFP_CALLTYPE BfpFile_Create(const char* path, BfpFileCreateK
|
|||
creationDisposition = CREATE_ALWAYS;
|
||||
}
|
||||
else if (createKind == BfpFileCreateKind_CreateIfNotExists)
|
||||
{
|
||||
{
|
||||
creationDisposition = CREATE_NEW;
|
||||
}
|
||||
else if (createKind == BfpFileCreateKind_OpenAlways)
|
||||
{
|
||||
creationDisposition = OPEN_ALWAYS;
|
||||
}
|
||||
else
|
||||
{
|
||||
creationDisposition = OPEN_EXISTING;
|
||||
|
|
|
@ -234,6 +234,7 @@ namespace System
|
|||
CreateAlways,
|
||||
CreateIfNotExists,
|
||||
OpenExisting,
|
||||
OpenAlways,
|
||||
};
|
||||
|
||||
public enum BfpFileCreateFlags : int32
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue