Merge pull request #10703 from Dentomologist/remove_getsysdirectory_spam

Remove GetSysDirectory spam
This commit is contained in:
Admiral H. Curtiss 2022-06-02 19:20:48 +02:00 committed by GitHub
commit fc6ba6b686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 12 deletions

View File

@ -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

View File

@ -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);