diff --git a/pydoro/pydoro_core/config.py b/pydoro/pydoro_core/config.py index 7c9b9f3..722cb16 100644 --- a/pydoro/pydoro_core/config.py +++ b/pydoro/pydoro_core/config.py @@ -84,7 +84,7 @@ def _ini_parse(self): self._conf["Trigger"]["exit_cmd"] = "[]" filename = os.environ.get( - "PYDORO_CONFIG_FILE", os.path.expanduser("~/.pydoro.ini") + "PYDORO_CONFIG_FILE", os.path.expanduser("~/.config/pydoro/pydoro.ini") ) if os.path.exists(filename): @@ -95,11 +95,16 @@ def _ini_parse(self): def _create_default_ini(self, filename): """ Creates default ini configuration file - Saves it in '~/.pydoro.ini' or the location specified by PYDORO_CONFIG_FILE environment variable + Saves it in '~/.config/pydoro/pydoro.ini' or the location specified by PYDORO_CONFIG_FILE environment variable """ + + config_dir = os.path.expanduser("~/.config/pydoro") + os.makedirs(config_dir, exist_ok=True) + os.chdir(config_dir) + with open(filename, "w+") as configfile: self._conf.write(configfile) - + def _ini_load(self): """ Loads the .ini config file preferences