Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10703 from Dentomologist/remove_getsysdirectory_spam
Remove GetSysDirectory spam
  • Loading branch information
AdmiralCurtiss committed Jun 2, 2022
2 parents 70bf89f + e0c9ae1 commit fc6ba6b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
27 changes: 16 additions & 11 deletions Source/Core/Common/FileUtil.cpp
Expand Up @@ -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__
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/FileUtil.h
Expand Up @@ -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);
Expand Down

0 comments on commit fc6ba6b

Please sign in to comment.