diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-06-02 19:20:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-02 19:20:48 +0200 |
| commit | fc6ba6b686906140bbac16bff5e518608d02c00d (patch) | |
| tree | 2958088109f69c46720f950932275c1c62cafd3e /Source/Core/Common/FileUtil.cpp | |
| parent | 70bf89fa59e3bd48633677374ca26124d36ff7e5 (diff) | |
| parent | e0c9ae16b97a32ef4b778729200e4a9e552ce665 (diff) | |
Merge pull request #10703 from Dentomologist/remove_getsysdirectory_spam
Remove GetSysDirectory spam
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
| -rw-r--r-- | Source/Core/Common/FileUtil.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index a218f6cb8e..522d3028fa 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -885,10 +885,8 @@ std::string GetExeDirectory() #endif } -std::string GetSysDirectory() +static std::string CreateSysDirectoryPath() { - std::string sysDir; - #if defined(_WIN32) || defined(LINUX_LOCAL_DEV) #define SYSDATA_DIR "Sys" #elif defined __APPLE__ @@ -902,25 +900,32 @@ std::string GetSysDirectory() #endif #if defined(__APPLE__) - sysDir = GetBundleDirectory() + DIR_SEP + SYSDATA_DIR; + const std::string sys_directory = GetBundleDirectory() + DIR_SEP SYSDATA_DIR DIR_SEP; #elif defined(_WIN32) || defined(LINUX_LOCAL_DEV) - sysDir = GetExeDirectory() + DIR_SEP + SYSDATA_DIR; + const std::string sys_directory = GetExeDirectory() + DIR_SEP SYSDATA_DIR DIR_SEP; #elif defined ANDROID - sysDir = s_android_sys_directory; - ASSERT_MSG(COMMON, !sysDir.empty(), "Sys directory has not been set"); + const std::string sys_directory = s_android_sys_directory + DIR_SEP; + ASSERT_MSG(COMMON, !s_android_sys_directory.empty(), "Sys directory has not been set"); #else - sysDir = SYSDATA_DIR; + const std::string sys_directory = SYSDATA_DIR DIR_SEP; #endif - sysDir += DIR_SEP; - INFO_LOG_FMT(COMMON, "GetSysDirectory: Setting to {}:", sysDir); - return sysDir; + INFO_LOG_FMT(COMMON, "CreateSysDirectoryPath: Setting to {}", sys_directory); + return sys_directory; +} + +const std::string& GetSysDirectory() +{ + static const std::string sys_directory = CreateSysDirectoryPath(); + return sys_directory; } #ifdef ANDROID void SetSysDirectory(const std::string& path) { INFO_LOG_FMT(COMMON, "Setting Sys directory to {}", path); + ASSERT_MSG(COMMON, s_android_sys_directory.empty(), "Sys directory already set to {}", + s_android_sys_directory); s_android_sys_directory = path; } #endif |
