windows: move config.yml and games.yml to /config/

This commit is contained in:
Megamouse 2025-01-02 12:24:25 +01:00
parent 5c2c4a6649
commit 451e953d26
20 changed files with 76 additions and 94 deletions

View file

@ -2021,7 +2021,7 @@ std::string fs::get_executable_dir()
return s_exe_dir;
}
const std::string& fs::get_config_dir()
const std::string& fs::get_config_dir([[maybe_unused]] bool get_config_subdirectory)
{
// Use magic static
static const std::string s_dir = []
@ -2103,6 +2103,14 @@ const std::string& fs::get_config_dir()
return dir;
}();
#ifdef _WIN32
if (get_config_subdirectory)
{
static const std::string subdir = s_dir + "config/";
return subdir;
}
#endif
return s_dir;
}

View file

@ -599,8 +599,8 @@ namespace fs
// Get executable containing directory
std::string get_executable_dir();
// Get configuration directory
const std::string& get_config_dir();
// Get configuration directory. Set get_config_subdirectory to true to get the nested config dir on windows.
const std::string& get_config_dir(bool get_config_subdirectory = false);
// Get common cache directory
const std::string& get_cache_dir();

View file

@ -125,19 +125,15 @@ patch_engine::patch_engine()
std::string patch_engine::get_patch_config_path()
{
#ifdef _WIN32
const std::string config_dir = fs::get_config_dir() + "config/";
const std::string config_dir = fs::get_config_dir(true);
const std::string patch_path = config_dir + "patch_config.yml";
#ifdef _WIN32
if (!fs::create_path(config_dir))
{
patch_log.error("Could not create path: %s (%s)", patch_path, fs::g_tls_error);
}
return patch_path;
#else
return fs::get_config_dir() + "patch_config.yml";
#endif
return patch_path;
}
std::string patch_engine::get_patches_path()