Add support for non portable mode (#356)

This commit is contained in:
SSimco
2022-10-12 08:03:26 +02:00
committed by GitHub
parent 2b9edced81
commit d6ba61cf64
38 changed files with 233 additions and 163 deletions
+8 -8
View File
@@ -76,9 +76,9 @@ bool InputManager::load(size_t player_index, std::string_view filename)
{
fs::path file_path;
if (filename.empty())
file_path = ActiveSettings::GetPath(fmt::format("controllerProfiles/controller{}", player_index));
file_path = ActiveSettings::GetConfigPath("controllerProfiles/controller{}", player_index);
else
file_path = ActiveSettings::GetPath(fmt::format("controllerProfiles/{}", filename));
file_path = ActiveSettings::GetConfigPath("controllerProfiles/{}", filename);
auto old_file = file_path;
old_file.replace_extension(".txt"); // test .txt extension
@@ -448,7 +448,7 @@ bool InputManager::save(size_t player_index, std::string_view filename)
if (!emulated_controller)
return false;
fs::path file_path = ActiveSettings::GetPath("controllerProfiles");
fs::path file_path = ActiveSettings::GetConfigPath("controllerProfiles");
fs::create_directories(file_path);
const auto is_default_file = filename.empty();
@@ -664,8 +664,8 @@ EmulatedControllerPtr InputManager::delete_controller(size_t player_index, bool
if(delete_profile)
{
std::error_code ec{};
fs::remove(ActiveSettings::GetPath(fmt::format("controllerProfiles/controller{}.xml", player_index)), ec);
fs::remove(ActiveSettings::GetPath(fmt::format("controllerProfiles/controller{}.txt", player_index)), ec);
fs::remove(ActiveSettings::GetConfigPath("controllerProfiles/controller{}.xml", player_index), ec);
fs::remove(ActiveSettings::GetConfigPath("controllerProfiles/controller{}.txt", player_index), ec);
}
return result;
@@ -680,8 +680,8 @@ EmulatedControllerPtr InputManager::delete_controller(size_t player_index, bool
controller = {};
std::error_code ec{};
fs::remove(ActiveSettings::GetPath(fmt::format("controllerProfiles/controller{}.xml", player_index)), ec);
fs::remove(ActiveSettings::GetPath(fmt::format("controllerProfiles/controller{}.txt", player_index)), ec);
fs::remove(ActiveSettings::GetConfigPath("controllerProfiles/controller{}.xml", player_index), ec);
fs::remove(ActiveSettings::GetConfigPath("controllerProfiles/controller{}.txt", player_index), ec);
return result;
}
@@ -782,7 +782,7 @@ void InputManager::apply_game_profile()
std::vector<std::string> InputManager::get_profiles()
{
const auto path = ActiveSettings::GetPath("controllerProfiles");
const auto path = ActiveSettings::GetConfigPath("controllerProfiles");
if (!exists(path))
return {};