Simplified config file existence test

This commit is contained in:
Bob Polis 2021-10-06 14:49:32 +02:00
parent 780e31b54d
commit 06047e6f0c

View File

@ -176,8 +176,9 @@ int main(int argc, const char * argv[]) {
main_saver = saver.get();
main_saver->setup(main_context.get(), {0, 0, WIDTH, HEIGHT});
std::string config_path {plugin_dir + "/" + saver_name + ".json"};
if (sc::file_exists(config_path)) {
std::ifstream config_file {config_path};
std::ifstream config_file {config_path};
if (config_file) {
std::cerr << "screensaver: reading config file " << config_path << '\n';
nlohmann::json j;
config_file >> j;
main_saver->config(j);