diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 8e42e0f42e..5707507a42 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -885,7 +885,7 @@ std::string GetExeDirectory() #endif } -std::string GetSysDirectory() +static std::string CreateSysDirectoryPath() { std::string sysDir; @@ -913,10 +913,16 @@ std::string GetSysDirectory() #endif sysDir += DIR_SEP; - INFO_LOG_FMT(COMMON, "GetSysDirectory: Setting to {}:", sysDir); + INFO_LOG_FMT(COMMON, "CreateSysDirectoryPath: Setting to {}", sysDir); return sysDir; } +const std::string& GetSysDirectory() +{ + static const std::string sys_directory = CreateSysDirectoryPath(); + return sys_directory; +} + #ifdef ANDROID void SetSysDirectory(const std::string& path) { diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index 0542cb3402..2672e237de 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -215,7 +215,7 @@ void SetUserPath(unsigned int dir_index, std::string path); std::string GetThemeDir(const std::string& theme_name); // Returns the path to where the sys file are -std::string GetSysDirectory(); +const std::string& GetSysDirectory(); #ifdef ANDROID void SetSysDirectory(const std::string& path);