Skip to content
Snippets Groups Projects
Commit c5f5750c authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#14569: Refactor configuration file existence test and exception handling

parent aac94b9f
No related branches found
No related tags found
No related merge requests found
......@@ -98,16 +98,28 @@ void ManagerImpl::init(const std::string &config_file)
DEBUG("Configuration file path: %s", path_.c_str());
try {
std::fstream testFileExistence(path_.c_str(), std::fstream::in);
bool fileExist = testFileExistence.good();
testFileExistence.close();
if(fileExist) {
Conf::YamlParser parser(path_.c_str());
parser.serializeEvents();
parser.composeEvents();
parser.constructNativeData();
loadAccountMap(parser);
} catch (const Conf::YamlParserException &e) {
ERROR("%s", e.what());
fflush(stderr);
}
else {
WARN("Config file not found: creating default account map");
loadDefaultAccountMap();
}
}
catch (const Conf::YamlParserException &e) {
ERROR("%s", e.what());
}
catch(std::fstream::failure &e) {
ERROR("%s", e.what());
}
initAudioDriver();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment