diff options
author | rtk0c <[email protected]> | 2022-06-27 18:27:13 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-27 18:27:13 -0700 |
commit | 8f0dda5eab181b0f14f2652b4e984aaaae3f258c (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /core/src/Utils/IO/CstdioFile.cpp | |
parent | fad6a88a13ab1f888ab25ad0aae19c1d63aa0623 (diff) |
Start from a clean slate
Diffstat (limited to 'core/src/Utils/IO/CstdioFile.cpp')
-rw-r--r-- | core/src/Utils/IO/CstdioFile.cpp | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/core/src/Utils/IO/CstdioFile.cpp b/core/src/Utils/IO/CstdioFile.cpp deleted file mode 100644 index 0f6378a..0000000 --- a/core/src/Utils/IO/CstdioFile.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "CstdioFile.hpp" - -#include "Utils/Macros.hpp" - -#pragma push_macro("MODE_STRING") -#undef MODE_STRING - -#if defined(_WIN32) -# define MODE_STRING(x) L##x -#else -# define MODE_STRING(x) x -#endif - -namespace CPLT_UNITY_ID { -auto GetModeString(FileUtils::IoMode mode) -{ - switch (mode) { - case FileUtils::IM_Read: return MODE_STRING("rb"); - case FileUtils::IM_WriteAppend: return MODE_STRING("ab"); - case FileUtils::IM_WriteTruncate: return MODE_STRING("wb"); - } - return MODE_STRING(""); -} -} // namespace CPLT_UNITY_ID - -#pragma pop_macro("MODE_STRING") - -FILE* FileUtils::OpenCstdioFile(const std::filesystem::path& path, IoMode mode) -{ -#ifdef _WIN32 - // std::filesystem::path::c_str() returns `const wchar_t*` under Windows, because NT uses UTF-16 natively - return _wfopen(path.c_str(), ::GetModeString(mode)); -#else - return fopen(path.c_str(), CPLT_UNITY_ID::GetModeString(mode)); -#endif -} |