diff options
Diffstat (limited to 'include/llfio/v2.0/detail/impl/windows/file_handle.ipp')
-rw-r--r-- | include/llfio/v2.0/detail/impl/windows/file_handle.ipp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/llfio/v2.0/detail/impl/windows/file_handle.ipp b/include/llfio/v2.0/detail/impl/windows/file_handle.ipp index 9802f25c..3a2d4f62 100644 --- a/include/llfio/v2.0/detail/impl/windows/file_handle.ipp +++ b/include/llfio/v2.0/detail/impl/windows/file_handle.ipp @@ -52,9 +52,12 @@ result<file_handle> file_handle::file(const path_handle &base, file_handle::path case creation::if_needed: creatdisp = 0x00000003 /*FILE_OPEN_IF*/; break; - case creation::truncate: + case creation::truncate_existing: creatdisp = 0x00000004 /*FILE_OVERWRITE*/; break; + case creation::always_new: + creatdisp = 0x00000000 /*FILE_SUPERSEDE*/; + break; } attribs &= 0x00ffffff; // the real attributes only, not the win32 flags @@ -104,7 +107,8 @@ result<file_handle> file_handle::file(const path_handle &base, file_handle::path case creation::if_needed: need_to_set_sparse = (isb.Information == 2 /*FILE_CREATED*/); break; - case creation::truncate: + case creation::truncate_existing: + case creation::always_new: need_to_set_sparse = true; break; } @@ -122,9 +126,12 @@ result<file_handle> file_handle::file(const path_handle &base, file_handle::path case creation::if_needed: creation = OPEN_ALWAYS; break; - case creation::truncate: + case creation::truncate_existing: creation = TRUNCATE_EXISTING; break; + case creation::always_new: + creation = CREATE_ALWAYS; + break; } path_view::c_str zpath(path, false); if(INVALID_HANDLE_VALUE == (nativeh.h = CreateFileW_(zpath.buffer, access, fileshare, nullptr, creation, attribs, nullptr))) // NOLINT @@ -144,7 +151,8 @@ result<file_handle> file_handle::file(const path_handle &base, file_handle::path case creation::if_needed: need_to_set_sparse = (GetLastError() != ERROR_ALREADY_EXISTS); // new inode created break; - case creation::truncate: + case creation::truncate_existing: + case creation::always_new: need_to_set_sparse = true; break; } |