FileUtil: Refactor CreateSysDirectoryPath()

This commit is contained in:
Dentomologist 2022-05-27 23:49:28 -07:00
parent c2be78079c
commit e0c9ae16b9
1 changed files with 7 additions and 10 deletions

View File

@ -887,8 +887,6 @@ std::string GetExeDirectory()
static std::string CreateSysDirectoryPath() static std::string CreateSysDirectoryPath()
{ {
std::string sysDir;
#if defined(_WIN32) || defined(LINUX_LOCAL_DEV) #if defined(_WIN32) || defined(LINUX_LOCAL_DEV)
#define SYSDATA_DIR "Sys" #define SYSDATA_DIR "Sys"
#elif defined __APPLE__ #elif defined __APPLE__
@ -902,19 +900,18 @@ static std::string CreateSysDirectoryPath()
#endif #endif
#if defined(__APPLE__) #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) #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 #elif defined ANDROID
sysDir = s_android_sys_directory; const std::string sys_directory = s_android_sys_directory + DIR_SEP;
ASSERT_MSG(COMMON, !sysDir.empty(), "Sys directory has not been set"); ASSERT_MSG(COMMON, !s_android_sys_directory.empty(), "Sys directory has not been set");
#else #else
sysDir = SYSDATA_DIR; const std::string sys_directory = SYSDATA_DIR DIR_SEP;
#endif #endif
sysDir += DIR_SEP;
INFO_LOG_FMT(COMMON, "CreateSysDirectoryPath: Setting to {}", sysDir); INFO_LOG_FMT(COMMON, "CreateSysDirectoryPath: Setting to {}", sys_directory);
return sysDir; return sys_directory;
} }
const std::string& GetSysDirectory() const std::string& GetSysDirectory()