diff options
Diffstat (limited to 'src/tracker_config.cpp')
-rw-r--r-- | src/tracker_config.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tracker_config.cpp b/src/tracker_config.cpp index 11e1cec..b0f4ac4 100644 --- a/src/tracker_config.cpp +++ b/src/tracker_config.cpp | |||
@@ -4,11 +4,11 @@ | |||
4 | 4 | ||
5 | #include <fstream> | 5 | #include <fstream> |
6 | 6 | ||
7 | constexpr const char* CONFIG_FILE_NAME = "config.yaml"; | 7 | #include "global.h" |
8 | 8 | ||
9 | void TrackerConfig::Load() { | 9 | void TrackerConfig::Load() { |
10 | try { | 10 | try { |
11 | YAML::Node file = YAML::LoadFile(CONFIG_FILE_NAME); | 11 | YAML::Node file = YAML::LoadFile(filename_); |
12 | 12 | ||
13 | ap_server = file["ap_server"].as<std::string>(); | 13 | ap_server = file["ap_server"].as<std::string>(); |
14 | ap_player = file["ap_player"].as<std::string>(); | 14 | ap_player = file["ap_player"].as<std::string>(); |
@@ -32,11 +32,12 @@ void TrackerConfig::Save() { | |||
32 | output["hybrid_areas"] = hybrid_areas; | 32 | output["hybrid_areas"] = hybrid_areas; |
33 | output["show_hunt_panels"] = show_hunt_panels; | 33 | output["show_hunt_panels"] = show_hunt_panels; |
34 | 34 | ||
35 | std::ofstream filewriter(CONFIG_FILE_NAME); | 35 | std::ofstream filewriter(filename_); |
36 | filewriter << output; | 36 | filewriter << output; |
37 | } | 37 | } |
38 | 38 | ||
39 | TrackerConfig& GetTrackerConfig() { | 39 | TrackerConfig& GetTrackerConfig() { |
40 | static TrackerConfig* instance = new TrackerConfig(); | 40 | static TrackerConfig* instance = |
41 | new TrackerConfig(GetAbsolutePath("config.yaml")); | ||
41 | return *instance; | 42 | return *instance; |
42 | } | 43 | } |