Browse Source

Always read config.ini in the executable directory

Xi Ruoyao 5 years ago
parent
commit
a41e3206d9
1 changed files with 4 additions and 1 deletions
  1. 4 1
      config.cc

+ 4 - 1
config.cc

@@ -2,6 +2,7 @@
 #include <boost/property_tree/ini_parser.hpp>
 
 #include "config.hpp"
+#include "executable.hpp"
 
 double conf_aggr_ts;
 double conf_aggr_tav;
@@ -14,7 +15,9 @@ public:
 	_config_()
 	{
 		boost::property_tree::ptree pt;
-		boost::property_tree::ini_parser::read_ini("config.ini", pt);
+		boost::filesystem::path path = get_executable_directory();
+		path /= "config.ini";
+		boost::property_tree::ini_parser::read_ini(path.string(), pt);
 		conf_aggr_ts = pt.get<double>("aggregation.ts");
 		conf_aggr_tav = pt.get<double>("aggregation.tav");
 		conf_debug_dump_flight_data = pt.get<bool>("debug.dump_flight_data");