about summary refs log tree commit diff stats
path: root/src/tracker_config.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-11-26 14:05:29 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2023-11-26 14:05:29 -0500
commit2adce1795211fd0a42c3b4e03ab35a90bb01bccf (patch)
tree7fda2f874f0653e4c74edaaf1547fe9802b2005a /src/tracker_config.cpp
parent7fc0e0f50ae961efbe0cac1032b03a42d41d87d5 (diff)
downloadlingo-ap-tracker-2adce1795211fd0a42c3b4e03ab35a90bb01bccf.tar.gz
lingo-ap-tracker-2adce1795211fd0a42c3b4e03ab35a90bb01bccf.tar.bz2
lingo-ap-tracker-2adce1795211fd0a42c3b4e03ab35a90bb01bccf.zip
Stop relying on correctly set working directory
Diffstat (limited to 'src/tracker_config.cpp')
-rw-r--r--src/tracker_config.cpp9
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
7constexpr const char* CONFIG_FILE_NAME = "config.yaml"; 7#include "global.h"
8 8
9void TrackerConfig::Load() { 9void 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
39TrackerConfig& GetTrackerConfig() { 39TrackerConfig& 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}