Fix tdatadir and patchdir in config file requiring a terminating slash

This commit is contained in:
dongresource 2021-11-06 06:01:14 +01:00
parent 4fa18a9642
commit 7249b54127

View File

@ -1073,12 +1073,12 @@ void TableData::init() {
std::ifstream fstream;
for (int i = 0; i < 7; i++) {
std::pair<json*, std::string>& table = tables[i];
fstream.open(settings::TDATADIR + table.second); // open file
fstream.open(settings::TDATADIR + "/" + table.second); // open file
if (!fstream.fail()) {
fstream >> *table.first; // load file contents into table
} else {
if (table.first != &gruntwork) { // gruntwork isn't critical
std::cerr << "[FATAL] Critical tdata file missing: " << settings::TDATADIR << table.second << std::endl;
std::cerr << "[FATAL] Critical tdata file missing: " << table.second << std::endl;
exit(1);
}
}
@ -1127,7 +1127,7 @@ void TableData::init() {
* Write gruntwork output to file
*/
void TableData::flush() {
std::ofstream file(settings::TDATADIR + settings::GRUNTWORKJSON);
std::ofstream file(settings::TDATADIR + "/" + settings::GRUNTWORKJSON);
json gruntwork;
for (auto& pair : RunningSkywayRoutes) {