diff options
| author | 2022-03-15 01:05:55 -0400 | |
|---|---|---|
| committer | 2022-03-15 03:48:40 -0400 | |
| commit | 24d51e1c925896e18e4536916b8c80f0b41e54fb (patch) | |
| tree | f9fa18cfbfbeb28484ac257f11de3ab836883e33 /src/yuzu_cmd/config.cpp | |
| parent | Merge pull request #8008 from ameerj/rescale-offsets-array (diff) | |
| download | yuzu-24d51e1c925896e18e4536916b8c80f0b41e54fb.tar.gz yuzu-24d51e1c925896e18e4536916b8c80f0b41e54fb.tar.xz yuzu-24d51e1c925896e18e4536916b8c80f0b41e54fb.zip | |
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.
Diffstat (limited to 'src/yuzu_cmd/config.cpp')
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
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 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | #include <optional> | ||
| 6 | #include <sstream> | 7 | #include <sstream> |
| 7 | 8 | ||
| 8 | // Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307 | 9 | // Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307 |
| @@ -29,11 +30,12 @@ | |||
| 29 | 30 | ||
| 30 | namespace FS = Common::FS; | 31 | namespace FS = Common::FS; |
| 31 | 32 | ||
| 32 | Config::Config() { | 33 | const std::filesystem::path default_config_path = |
| 33 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. | 34 | FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "sdl2-config.ini"; |
| 34 | sdl2_config_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "sdl2-config.ini"; | ||
| 35 | sdl2_config = std::make_unique<INIReader>(FS::PathToUTF8String(sdl2_config_loc)); | ||
| 36 | 35 | ||
| 36 | Config::Config(std::optional<std::filesystem::path> config_path) | ||
| 37 | : sdl2_config_loc{config_path.value_or(default_config_path)}, | ||
| 38 | sdl2_config{std::make_unique<INIReader>(FS::PathToUTF8String(sdl2_config_loc))} { | ||
| 37 | Reload(); | 39 | Reload(); |
| 38 | } | 40 | } |
| 39 | 41 | ||