From 24d51e1c925896e18e4536916b8c80f0b41e54fb Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 15 Mar 2022 01:05:55 -0400 Subject: yuzu_cmd: Allow user to specify config file location Adds an option `-c` or `--config` with one required argument that allows the user to specify to where the config file is located. Useful for scripts that run specific games with different preferences for settings. --- src/yuzu_cmd/config.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/yuzu_cmd/config.cpp') diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index b74411c84..131bc2201 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include +#include #include // Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307 @@ -29,11 +30,12 @@ namespace FS = Common::FS; -Config::Config() { - // TODO: Don't hardcode the path; let the frontend decide where to put the config files. - sdl2_config_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "sdl2-config.ini"; - sdl2_config = std::make_unique(FS::PathToUTF8String(sdl2_config_loc)); +const std::filesystem::path default_config_path = + FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "sdl2-config.ini"; +Config::Config(std::optional config_path) + : sdl2_config_loc{config_path.value_or(default_config_path)}, + sdl2_config{std::make_unique(FS::PathToUTF8String(sdl2_config_loc))} { Reload(); } -- cgit v1.2.3