From 24e76f296057a42ef54cc386ac9425d8f494d26b Mon Sep 17 00:00:00 2001 From: Eladash Date: Sat, 9 Oct 2021 21:07:52 +0300 Subject: [PATCH] fs: Add fs::write_new, promotes safe file creation (no overwrite) --- Utilities/File.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utilities/File.h b/Utilities/File.h index 58fed4ce39..adc8c4a572 100644 --- a/Utilities/File.h +++ b/Utilities/File.h @@ -45,7 +45,8 @@ namespace fs constexpr auto lock = +open_mode::lock; // Prevent opening the file more than once constexpr auto unread = +open_mode::unread; // Aggressively prevent reading the opened file (do not use) - constexpr auto rewrite = open_mode::write + open_mode::create + open_mode::trunc; + constexpr auto write_new = write + create + excl; + constexpr auto rewrite = write + create + trunc; // File seek mode enum class seek_mode : u32