From c08c45fc16894b38a6905faac42854835eb88233 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Wed, 24 Jan 2024 18:44:01 +0000 Subject: [PATCH] Prioritize loading configs next to devine over other locations --- devine/core/config.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/devine/core/config.py b/devine/core/config.py index 67f5822..9b09f8a 100644 --- a/devine/core/config.py +++ b/devine/core/config.py @@ -82,20 +82,20 @@ def get_config_path() -> Optional[Path]: Looks for a config file in the following folders in order: - 1. The AppDirs User Config Folder (e.g., %localappdata%/devine) - 2. The Devine Namespace Folder (e.g., %appdata%/Python/Python311/site-packages/devine) - 3. The Parent Folder to the Devine Namespace Folder (e.g., %appdata%/Python/Python311/site-packages) + 1. The Devine Namespace Folder (e.g., %appdata%/Python/Python311/site-packages/devine) + 2. The Parent Folder to the Devine Namespace Folder (e.g., %appdata%/Python/Python311/site-packages) + 3. The AppDirs User Config Folder (e.g., %localappdata%/devine) Returns None if no config file could be found. """ # noinspection PyProtectedMember - path = Config._Directories.user_configs / Config._Filenames.root_config - if not path.exists(): - # noinspection PyProtectedMember - path = Config._Directories.namespace_dir / Config._Filenames.root_config + path = Config._Directories.namespace_dir / Config._Filenames.root_config if not path.exists(): # noinspection PyProtectedMember path = Config._Directories.namespace_dir.parent / Config._Filenames.root_config + if not path.exists(): + # noinspection PyProtectedMember + path = Config._Directories.user_configs / Config._Filenames.root_config if not path.exists(): path = None return path