Remap: Refactor scripts #177
@ -53,17 +53,25 @@ def set_variable_file():
|
|||||||
return variables
|
return variables
|
||||||
|
|
||||||
|
|
||||||
def get_dir_to_map() -> str:
|
def get_dir_recursively(prompt: str):
|
||||||
dir_to_map = input("Please enter directory to map: ")
|
iterations = 0
|
||||||
if not Path(dir_to_map).is_dir():
|
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')
|
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:
|
def get_josn_file_dir() -> str:
|
||||||
json_dir = input("Please enter directory to store JSON map: ")
|
json_dir = get_dir_recursively("Please enter directory to store JSON map: ")
|
||||||
if not Path(json_dir).is_dir():
|
|
||||||
raise Exception('Provided path is not a directory')
|
|
||||||
return Path(json_dir).joinpath("dir_map.json").__str__()
|
return Path(json_dir).joinpath("dir_map.json").__str__()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user