diff options
Diffstat (limited to 'src/Config.cpp')
-rw-r--r-- | src/Config.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Config.cpp b/src/Config.cpp index b481374..31f8df9 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -58,7 +58,7 @@ namespace QuickMedia { } // No-op if this has already been called before - void init_config() { + static void init_config() { if(config_initialized) return; @@ -66,11 +66,16 @@ namespace QuickMedia { // Wtf? can't use static non-pointer config because it causes a segfault when setting config.theme. // It looks like a libc bug??? crashes for both gcc and clang. config = new Config(); + config->scale = get_ui_scale(); + Path config_path = get_storage_dir().join("config.json"); + if(get_file_type(config_path) != FileType::REGULAR) { + return; + } + Json::Value json_root; if(!read_file_as_json(config_path, json_root) || !json_root.isObject()) { fprintf(stderr, "Warning: failed to parse config file: %s\n", config_path.data.c_str()); - config->scale = get_ui_scale(); return; } |