aboutsummaryrefslogtreecommitdiff
path: root/zencore/filesystem.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-11-17 09:31:55 +0100
committerMartin Ridgers <[email protected]>2021-11-17 09:31:55 +0100
commitd949e730f4078335d0e48e591c05a92057f1c5f4 (patch)
treed84d42b31f3a58c0ceb5a7cfa17cf149bbaf2e3c /zencore/filesystem.cpp
parentCompile fix (diff)
downloadzen-d949e730f4078335d0e48e591c05a92057f1c5f4.tar.xz
zen-d949e730f4078335d0e48e591c05a92057f1c5f4.zip
Corrected flags to open() so behaviour matches Windows' CREATE_ALWAYS
Diffstat (limited to 'zencore/filesystem.cpp')
-rw-r--r--zencore/filesystem.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp
index 4456757a6..a4c81f6cc 100644
--- a/zencore/filesystem.cpp
+++ b/zencore/filesystem.cpp
@@ -545,11 +545,12 @@ WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t Buffer
}
#else
- int Fd = open(Path.c_str(), O_WRONLY);
+ int OpenFlags = O_WRONLY|O_CREAT|O_TRUNC;
+ int Fd = open(Path.c_str(), OpenFlags);
if (Fd < 0)
{
zen::CreateDirectories(Path.parent_path());
- Fd = open(Path.c_str(), O_WRONLY);
+ Fd = open(Path.c_str(), OpenFlags);
}
if (Fd < 0)