summaryrefslogtreecommitdiffstats
path: root/src/yuzu_cmd/config.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-03-19 09:33:50 +0100
committerGitHub <noreply@github.com>2022-03-19 09:33:50 +0100
commit17ebe211ec965f1e108c5dd076d3ac18ca831cc3 (patch)
treeb8d0daeb1f34598d9cf7a81ed7367ec265e4c36b /src/yuzu_cmd/config.cpp
parentMerge pull request #8028 from v1993/patch-9 (diff)
parentyuzu_cmd: Allow user to specify config file location (diff)
downloadyuzu-17ebe211ec965f1e108c5dd076d3ac18ca831cc3.tar
yuzu-17ebe211ec965f1e108c5dd076d3ac18ca831cc3.tar.gz
yuzu-17ebe211ec965f1e108c5dd076d3ac18ca831cc3.tar.bz2
yuzu-17ebe211ec965f1e108c5dd076d3ac18ca831cc3.tar.lz
yuzu-17ebe211ec965f1e108c5dd076d3ac18ca831cc3.tar.xz
yuzu-17ebe211ec965f1e108c5dd076d3ac18ca831cc3.tar.zst
yuzu-17ebe211ec965f1e108c5dd076d3ac18ca831cc3.zip
Diffstat (limited to 'src/yuzu_cmd/config.cpp')
-rw-r--r--src/yuzu_cmd/config.cpp10
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 @@
// Refer to the license.txt file included.
#include <memory>
+#include <optional>
#include <sstream>
// 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<INIReader>(FS::PathToUTF8String(sdl2_config_loc));
+const std::filesystem::path default_config_path =
+ FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "sdl2-config.ini";
+Config::Config(std::optional<std::filesystem::path> config_path)
+ : sdl2_config_loc{config_path.value_or(default_config_path)},
+ sdl2_config{std::make_unique<INIReader>(FS::PathToUTF8String(sdl2_config_loc))} {
Reload();
}