From 373792f9a66cf415888313f87a92ec2f3d1ebe3b Mon Sep 17 00:00:00 2001 From: sezanzeb Date: Sat, 21 Nov 2020 15:00:52 +0100 Subject: [PATCH] fixed config file doesnt exist --- keymapper/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/keymapper/config.py b/keymapper/config.py index f388663e..2679a247 100644 --- a/keymapper/config.py +++ b/keymapper/config.py @@ -87,6 +87,11 @@ class _Config: def save_config(self): """Save the config to the file system.""" + if not os.path.exists(CONFIG_PATH): + logger.debug('Creating "%s"', CONFIG_PATH) + os.makedirs(os.path.dirname(CONFIG_PATH), exist_ok=True) + os.mknod(CONFIG_PATH) + with open(CONFIG_PATH, 'w') as f: json.dump(self._config, f, indent=4) logger.info('Saved config to %s', CONFIG_PATH)