Skip to content

Commit

Permalink
Fallback to build date if unable to find version number
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Sep 9, 2024
1 parent c8efb0c commit d6d4de2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/shared/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,5 +478,26 @@ Config read_config() {
}
}

Config config = read_config(version);

if (!config.empty()){
return config;
}

#ifdef DEBUG
std::cerr
<< "Unable to find config for version number, looking for old build date instead"
<< std::endl;
#endif

std::ifstream version_file_buf{"/etc/version"};

if (!version_file_buf) {
std::cerr << "/etc/version - " << std::strerror(errno) << "\n";
std::exit(-1);
}

std::getline(version_file_buf, version);

return read_config(version);
}

0 comments on commit d6d4de2

Please sign in to comment.