From c3bdffcd50d7817c13cd650ae88b69478d5362f9 Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Sat, 16 Dec 2023 00:39:00 +0200 Subject: [PATCH] RareCore: Check if LEGENDARY_CONFIG_PATH is set before creating a new config --- rare/shared/rare_core.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rare/shared/rare_core.py b/rare/shared/rare_core.py index 101ace50..0486d271 100644 --- a/rare/shared/rare_core.py +++ b/rare/shared/rare_core.py @@ -133,10 +133,12 @@ class RareCore(QObject): self.__core = LegendaryCore() except configparser.MissingSectionHeaderError as e: logger.warning(f"Config is corrupt: {e}") - if config_path := os.environ.get("XDG_CONFIG_HOME"): - path = os.path.join(config_path, "legendary") + if config_path := os.environ.get('LEGENDARY_CONFIG_PATH'): + path = config_path + elif config_path := os.environ.get('XDG_CONFIG_HOME'): + path = os.path.join(config_path, 'legendary') else: - path = os.path.expanduser("~/.config/legendary") + path = os.path.expanduser('~/.config/legendary') with open(os.path.join(path, "config.ini"), "w") as config_file: config_file.write("[Legendary]") self.__core = LegendaryCore()