more dynamic .dll folder for exe packing

other config dir for windows build
This commit is contained in:
2020-05-05 17:02:39 +02:00
parent c3bc2293c7
commit d353a2485c
2 changed files with 43 additions and 32 deletions

View File

@ -21,13 +21,14 @@ std::string Config::chatId;
bool Config::readCredentials() {
libconfig::Config cfg;
try {
cfg.readFile("/etc/iprefresher.cfg");
// todo make dynamic here
cfg.readFile(Version::ConfigDir.c_str());
}
catch (const libconfig::FileIOException &fioex) {
std::cout << "I/O error while reading config file." << std::endl << "creating new config file!" << std::endl;
std::ofstream myfile;
myfile.open("/etc/iprefresher.cfg");
myfile.open(Version::ConfigDir);
if (myfile.is_open()) {
myfile << Version::SAMPLECONFIG;
myfile.close();
@ -66,7 +67,7 @@ bool Config::validateConfig() {
libconfig::Config cfg;
try {
Logger::message("reading config file");
cfg.readFile("/etc/iprefresher.cfg");
cfg.readFile(Version::ConfigDir.c_str());
}
catch (const libconfig::FileIOException &fioex) {
Logger::warning("config file doesn't exist or permission denied!");