mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
exit silently on error
This commit is contained in:
parent
977d8618c4
commit
41f81fb832
1 changed files with 7 additions and 5 deletions
12
src/main.cpp
12
src/main.cpp
|
|
@ -17,29 +17,31 @@
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
__attribute__((constructor)) void lsfgvk_init() {
|
__attribute__((constructor)) void lsfgvk_init() {
|
||||||
|
std::cerr << std::unitbuf;
|
||||||
|
|
||||||
// read configuration
|
// read configuration
|
||||||
const std::string file = Utils::getConfigFile();
|
const std::string file = Utils::getConfigFile();
|
||||||
try {
|
try {
|
||||||
Config::loadAndWatchConfig(file);
|
Config::loadAndWatchConfig(file);
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
std::cerr << "lsfg-vk: An error occured while trying to parse the configuration, exiting:\n";
|
std::cerr << "lsfg-vk: An error occured while trying to parse the configuration, IGNORING:\n";
|
||||||
std::cerr << "- " << e.what() << '\n';
|
std::cerr << "- " << e.what() << '\n';
|
||||||
Utils::showErrorGui(e.what());
|
return; // default configuration will unload
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto name = Utils::getProcessName();
|
const auto name = Utils::getProcessName();
|
||||||
try {
|
try {
|
||||||
Config::activeConf = Config::getConfig(name);
|
Config::activeConf = Config::getConfig(name);
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
std::cerr << "lsfg-vk: The configuration for " << name.second << " is invalid, exiting:\n";
|
std::cerr << "lsfg-vk: The configuration for " << name.second << " is invalid, IGNORING:\n";
|
||||||
std::cerr << e.what() << '\n';
|
std::cerr << e.what() << '\n';
|
||||||
Utils::showErrorGui(e.what());
|
return; // default configuration will unload
|
||||||
}
|
}
|
||||||
|
|
||||||
// exit silently if not enabled
|
// exit silently if not enabled
|
||||||
auto& conf = Config::activeConf;
|
auto& conf = Config::activeConf;
|
||||||
if (!conf.enable && name.second != "benchmark")
|
if (!conf.enable && name.second != "benchmark")
|
||||||
return;
|
return; // default configuration will unload
|
||||||
|
|
||||||
// print config
|
// print config
|
||||||
std::cerr << "lsfg-vk: Loaded configuration for " << name.second << ":\n";
|
std::cerr << "lsfg-vk: Loaded configuration for " << name.second << ":\n";
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue