|
|
|
@ -657,129 +657,117 @@ std::string GetSysDirectory()
|
|
|
|
|
|
|
|
|
|
// Returns a string with a Dolphin data dir or file in the user's home
|
|
|
|
|
// directory. To be used in "multi-user" mode (that is, installed).
|
|
|
|
|
//const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath)
|
|
|
|
|
//{
|
|
|
|
|
// static std::string paths[NUM_PATH_INDICES];
|
|
|
|
|
//
|
|
|
|
|
// // Set up all paths and files on the first run
|
|
|
|
|
// if (paths[D_USER_IDX].empty())
|
|
|
|
|
// {
|
|
|
|
|
//#ifdef _WIN32
|
|
|
|
|
// paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
|
|
|
|
|
//#else
|
|
|
|
|
// if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR))
|
|
|
|
|
// paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP;
|
|
|
|
|
// else
|
|
|
|
|
// paths[D_USER_IDX] = std::string(getenv("HOME") ?
|
|
|
|
|
// getenv("HOME") : getenv("PWD") ?
|
|
|
|
|
// getenv("PWD") : "") + DIR_SEP DOLPHIN_DATA_DIR DIR_SEP;
|
|
|
|
|
//#endif
|
|
|
|
|
//
|
|
|
|
|
// paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
|
|
|
|
|
// paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP;
|
|
|
|
|
// paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
|
|
|
|
|
// paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
|
|
|
|
|
// paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
|
|
|
|
|
// paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
|
|
|
|
|
// paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
|
|
|
|
|
// paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
|
|
|
|
|
// paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
|
|
|
|
|
// paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
|
|
|
|
|
// paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
|
|
|
|
// paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (!newPath.empty())
|
|
|
|
|
// {
|
|
|
|
|
// if (!File::IsDirectory(newPath))
|
|
|
|
|
// {
|
|
|
|
|
// WARN_LOG(COMMON, "Invalid path specified %s", newPath.c_str());
|
|
|
|
|
// return paths[DirIDX];
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// paths[DirIDX] = newPath;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// switch (DirIDX)
|
|
|
|
|
// {
|
|
|
|
|
// case D_WIIROOT_IDX:
|
|
|
|
|
// paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
|
|
|
|
|
// paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR + DIR_SEP;
|
|
|
|
|
// paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case D_USER_IDX:
|
|
|
|
|
// paths[D_GCUSER_IDX] = paths[D_USER_IDX] + GC_USER_DIR DIR_SEP;
|
|
|
|
|
// paths[D_WIIROOT_IDX] = paths[D_USER_IDX] + WII_USER_DIR;
|
|
|
|
|
// paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
|
|
|
|
|
// paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
|
|
|
|
|
// paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP;
|
|
|
|
|
// paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
|
|
|
|
|
// paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
|
|
|
|
|
// paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
|
|
|
|
|
// paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
|
|
|
|
|
// paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
|
|
|
|
|
// paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
|
|
|
|
|
// paths[D_OPENCL_IDX] = paths[D_USER_IDX] + OPENCL_DIR DIR_SEP;
|
|
|
|
|
// paths[D_HIRESTEXTURES_IDX] = paths[D_USER_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMPDSP_IDX] = paths[D_DUMP_IDX] + DUMP_DSP_DIR DIR_SEP;
|
|
|
|
|
// paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
|
|
|
|
|
// paths[D_MAILLOGS_IDX] = paths[D_LOGS_IDX] + MAIL_LOGS_DIR DIR_SEP;
|
|
|
|
|
// paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR DIR_SEP;
|
|
|
|
|
// paths[D_THEMES_IDX] = paths[D_USER_IDX] + THEMES_DIR DIR_SEP;
|
|
|
|
|
// paths[F_DOLPHINCONFIG_IDX] = paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
|
|
|
|
|
// paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
|
|
|
|
|
// paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
|
|
|
|
// paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
|
|
|
|
|
// paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
|
|
|
|
|
// paths[F_RAMDUMP_IDX] = paths[D_DUMP_IDX] + RAM_DUMP;
|
|
|
|
|
// paths[F_ARAMDUMP_IDX] = paths[D_DUMP_IDX] + ARAM_DUMP;
|
|
|
|
|
// paths[F_FAKEVMEMDUMP_IDX] = paths[D_DUMP_IDX] + FAKEVMEM_DUMP;
|
|
|
|
|
// paths[F_GCSRAM_IDX] = paths[D_GCUSER_IDX] + GC_SRAM;
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case D_CONFIG_IDX:
|
|
|
|
|
// paths[F_DOLPHINCONFIG_IDX] = paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
|
|
|
|
|
// paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
|
|
|
|
|
// paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case D_DUMP_IDX:
|
|
|
|
|
// paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
|
|
|
|
|
// paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case D_LOGS_IDX:
|
|
|
|
|
// paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return paths[DirIDX];
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
std::string GetThemeDir(const std::string& theme_name)
|
|
|
|
|
const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath)
|
|
|
|
|
{
|
|
|
|
|
std::string dir = File::GetUserPath(D_THEMES_IDX) + theme_name + "/";
|
|
|
|
|
static std::string paths[NUM_PATH_INDICES];
|
|
|
|
|
|
|
|
|
|
#if !defined(_WIN32)
|
|
|
|
|
// If theme does not exist in user's dir load from shared directory
|
|
|
|
|
if (!File::Exists(dir))
|
|
|
|
|
dir = SHARED_USER_DIR THEMES_DIR "/" + theme_name + "/";
|
|
|
|
|
// Set up all paths and files on the first run
|
|
|
|
|
if (paths[D_USER_IDX].empty())
|
|
|
|
|
{
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
|
|
|
|
|
#else
|
|
|
|
|
if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR))
|
|
|
|
|
paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP;
|
|
|
|
|
else
|
|
|
|
|
paths[D_USER_IDX] = std::string(getenv("HOME") ?
|
|
|
|
|
getenv("HOME") : getenv("PWD") ?
|
|
|
|
|
getenv("PWD") : "") + DIR_SEP DOLPHIN_DATA_DIR DIR_SEP;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
|
|
|
|
|
paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP;
|
|
|
|
|
paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
|
|
|
|
|
paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
|
|
|
|
|
paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
|
|
|
|
|
paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
|
|
|
|
|
paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
|
|
|
|
|
paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
|
|
|
|
|
paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
|
|
|
|
|
paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
|
|
|
|
|
paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
|
|
|
|
paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!newPath.empty())
|
|
|
|
|
{
|
|
|
|
|
if (!File::IsDirectory(newPath))
|
|
|
|
|
{
|
|
|
|
|
WARN_LOG(COMMON, "Invalid path specified %s", newPath.c_str());
|
|
|
|
|
return paths[DirIDX];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
paths[DirIDX] = newPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (DirIDX)
|
|
|
|
|
{
|
|
|
|
|
case D_ROOT_IDX:
|
|
|
|
|
paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP;
|
|
|
|
|
paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR + DIR_SEP;
|
|
|
|
|
paths[F_SYSCONF_IDX] = paths[D_SYSCONF_IDX] + SYSCONF;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case D_USER_IDX:
|
|
|
|
|
paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP;
|
|
|
|
|
paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
|
|
|
|
|
paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP;
|
|
|
|
|
paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
|
|
|
|
|
paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
|
|
|
|
|
paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
|
|
|
|
|
paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
|
|
|
|
|
paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
|
|
|
|
|
paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
|
|
|
|
|
paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
|
|
|
|
|
paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR DIR_SEP;
|
|
|
|
|
paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG;
|
|
|
|
|
paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
|
|
|
|
|
paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
|
|
|
|
paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case D_CONFIG_IDX:
|
|
|
|
|
paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG;
|
|
|
|
|
paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
|
|
|
|
|
paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case D_DUMP_IDX:
|
|
|
|
|
paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
|
|
|
|
|
paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case D_LOGS_IDX:
|
|
|
|
|
paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dir;
|
|
|
|
|
return paths[DirIDX];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//std::string GetThemeDir(const std::string& theme_name)
|
|
|
|
|
//{
|
|
|
|
|
// std::string dir = File::GetUserPath(D_THEMES_IDX) + theme_name + "/";
|
|
|
|
|
//
|
|
|
|
|
//#if !defined(_WIN32)
|
|
|
|
|
// // If theme does not exist in user's dir load from shared directory
|
|
|
|
|
// if (!File::Exists(dir))
|
|
|
|
|
// dir = SHARED_USER_DIR THEMES_DIR "/" + theme_name + "/";
|
|
|
|
|
//#endif
|
|
|
|
|
//
|
|
|
|
|
// return dir;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
bool WriteStringToFile(bool text_file, const std::string &str, const char *filename)
|
|
|
|
|
{
|
|
|
|
|
return File::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size());
|
|
|
|
|