diff options
author | Lioncash <mathew1800@gmail.com> | 2020-08-15 08:33:16 -0400 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-08-16 06:52:40 -0400 |
commit | c4ed791164df7e3e74042a37a62077b4dc4ade91 (patch) | |
tree | 12bbcc09d0db32a0b6b5dc1bc49245964486da63 /src/common/file_util.h | |
parent | db96034ea429cf0b0b5e2bac790392d9e2f50990 (diff) |
common/fileutil: Convert namespace to Common::FS
Migrates a remaining common file over to the Common namespace, making it
consistent with the rest of common files.
This also allows for high-traffic FS related code to alias the
filesystem function namespace as
namespace FS = Common::FS;
for more concise typing.
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 681b281373..8b587320f2 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 |