diff options
author | bunnei <bunneidev@gmail.com> | 2020-08-17 22:35:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 22:35:30 -0400 |
commit | 56c6a5def85cfd3001c88d69374e3fb164272b9e (patch) | |
tree | dfdceb64cc5c6c4f80f384206a080f77d7cc40ae /src/common/file_util.h | |
parent | 0c885249df93db3262ae6ed2df18ee1cad336723 (diff) | |
parent | c4ed791164df7e3e74042a37a62077b4dc4ade91 (diff) |
Merge pull request #4535 from lioncash/fileutil
common/fileutil: Convert namespace to Common::FS
Diffstat (limited to 'src/common/file_util.h')
-rw-r--r-- | src/common/file_util.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/common/file_util.h b/src/common/file_util.h index 681b28137..8b587320f 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -19,7 +19,7 @@ #include "common/string_util.h" #endif -namespace FileUtil { +namespace Common::FS { // User paths for GetUserPath enum class UserPath { @@ -204,6 +204,16 @@ enum class DirectorySeparator { std::string_view path, DirectorySeparator directory_separator = DirectorySeparator::ForwardSlash); +// To deal with Windows being dumb at Unicode +template <typename T> +void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode) { +#ifdef _MSC_VER + fstream.open(Common::UTF8ToUTF16W(filename), openmode); +#else + fstream.open(filename, openmode); +#endif +} + // simple wrapper for cstdlib file functions to // hopefully will make error checking easier // and make forgetting an fclose() harder @@ -285,14 +295,4 @@ private: std::FILE* m_file = nullptr; }; -} // namespace FileUtil - -// To deal with Windows being dumb at unicode: -template <typename T> -void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode) { -#ifdef _MSC_VER - fstream.open(Common::UTF8ToUTF16W(filename), openmode); -#else - fstream.open(filename, openmode); -#endif -} +} // namespace Common::FS |