From 3e432ffc21b448c9974cc2a3dc2087e40e1a1c48 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 30 Jul 2019 23:34:11 +0200 Subject: [PATCH] [DEBUG] correct the user configuration path --- island/__init__.py | 6 ++---- island/env.py | 9 +++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/island/__init__.py b/island/__init__.py index c071567..6238340 100755 --- a/island/__init__.py +++ b/island/__init__.py @@ -156,14 +156,12 @@ def parse_generic_arg(argument, active): return False # open configuration of island: -config_file_name = "islandConfig.py" -# TODO: Change get_run_path with folder of .island -config_file = os.path.join(tools.get_run_path(), config_file_name) +config_file = env.get_island_path_user_config() if os.path.isfile(config_file) == True: sys.path.append(os.path.dirname(config_file)) debug.debug("Find basic configuration file: '" + config_file + "'") # the file exist, we can open it and get the initial configuration: - configuration_file = __import__(config_file_name[:-3]) + configuration_file = __import__(env.get_system_config_name()[:-3]) if "get_exclude_path" in dir(configuration_file): data = configuration_file.get_exclude_path() diff --git a/island/env.py b/island/env.py index 7e68370..dcc7d89 100644 --- a/island/env.py +++ b/island/env.py @@ -25,6 +25,10 @@ def get_system_base_name(): global system_base_name return system_base_name +def get_system_config_name(): + global system_base_name + return system_base_name + "Config.py" + fetch_manifest = True @@ -96,6 +100,7 @@ elif os.path.exists(os.path.join(island_root_path, "..", "..", "..", "..", "..", else: #debug.error("the root path of " + get_system_base_name() + " must not be upper that 6 parent path") pass +island_path_user_config = os.path.join(island_root_path, get_system_config_name()) island_path = os.path.join(island_root_path, "." + get_system_base_name()) island_path_config = os.path.join(island_path, "config.txt") island_path_manifest = os.path.join(island_path, "manifest") @@ -120,4 +125,8 @@ def get_island_path_manifest(): global island_path_manifest return island_path_manifest +def get_island_path_user_config(): + global island_path_user_config + return island_path_user_config +