[DEV] add possiblility to execute in an other sub-path

This commit is contained in:
Edouard DUPIN 2017-04-13 23:12:57 +02:00
parent 94f79962c4
commit a605da450f
2 changed files with 20 additions and 2 deletions

View File

@ -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)

View File

@ -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")