Remap: Refactor scripts #177

Merged
Nick Alberelli merged 17 commits from :feature/refactor-remap-script into main 2023-12-07 16:17:27 +01:00
Showing only changes of commit 90784b6b58 - Show all commits

View File

@ -53,17 +53,25 @@ def set_variable_file():
return variables
def get_dir_to_map() -> str:
dir_to_map = input("Please enter directory to map: ")
if not Path(dir_to_map).is_dir():
def get_dir_recursively(prompt: str):
iterations = 0
dir_to_map = input(prompt)
if Path(dir_to_map).is_dir():
iterations += 1
return dir_to_map
if iterations > 10:
raise Exception('Provided path is not a directory')
return dir_to_map
else:
print('Provided path is not a directory')
return get_dir_recursively(prompt)
def get_dir_to_map() -> str:
return get_dir_recursively("Please enter directory to map: ")
def get_josn_file_dir() -> str:
json_dir = input("Please enter directory to store JSON map: ")
if not Path(json_dir).is_dir():
raise Exception('Provided path is not a directory')
json_dir = get_dir_recursively("Please enter directory to store JSON map: ")
return Path(json_dir).joinpath("dir_map.json").__str__()