diff --git a/island/__init__.py b/island/__init__.py index 4478cb0..ad18e8d 100755 --- a/island/__init__.py +++ b/island/__init__.py @@ -220,8 +220,8 @@ if action_to_do not in list_actions: # todo : Remove this if action_to_do != "init" \ - and os.path.exists("." + env.get_system_base_name()) == False: - debug.error("Can not execute a island cmd if we have not initialize a config: '" + str("." + env.get_system_base_name()) + "'") + and os.path.exists(env.get_island_path()) == False: + debug.error("Can not execute a island cmd if we have not initialize a config: '" + str("." + env.get_system_base_name()) + "' in upper 6 parent path") exit(-1) diff --git a/island/env.py b/island/env.py index 1524acf..63624af 100644 --- a/island/env.py +++ b/island/env.py @@ -28,6 +28,24 @@ def get_system_base_name(): island_root_path = os.path.join(os.getcwd()) +if os.path.exists(os.path.join(island_root_path, "." + get_system_base_name())) == True: + # all is good ... + debug.error("plop: " + os.path.join(island_root_path, "." + get_system_base_name())) + pass +elif os.path.exists(os.path.join(island_root_path, "..", "." + get_system_base_name())) == True: + island_root_path = os.path.join(os.getcwd(), "..") +elif os.path.exists(os.path.join(island_root_path, "..", "..", "." + get_system_base_name())) == True: + island_root_path = os.path.join(os.getcwd(), "..", "..") +elif os.path.exists(os.path.join(island_root_path, "..", "..", "..", "." + get_system_base_name())) == True: + island_root_path = os.path.join(os.getcwd(), "..", "..", "..") +elif os.path.exists(os.path.join(island_root_path, "..", "..", "..", "." + get_system_base_name())) == True: + island_root_path = os.path.join(os.getcwd(), "..", "..", "..") +elif os.path.exists(os.path.join(island_root_path, "..", "..", "..", "..", "." + get_system_base_name())) == True: + island_root_path = os.path.join(os.getcwd(), "..", "..", "..", "..") +elif os.path.exists(os.path.join(island_root_path, "..", "..", "..", "..", "..", "." + get_system_base_name())) == True: + island_root_path = os.path.join(os.getcwd(), "..", "..", "..", "..", "..") +else: + debug.error("the root path of " + get_system_base_name() + " must not be upper that 6 parent path") 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")