Update utils to current project

This commit is contained in:
Kiryl
2022-08-03 16:44:23 +03:00
parent e3290b23bb
commit 3cd793ea78
3 changed files with 36 additions and 38 deletions

View File

@@ -9,7 +9,7 @@ def parse_args():
return args
def check_dir(dir_path):
def check_dir(dir_path: str):
if not os.path.exists(dir_path):
try:
os.mkdir(dir_path)
@@ -20,15 +20,13 @@ def check_dir(dir_path):
if __name__ == "__main__":
folders = parse_args().folders
if not folders:
folders = ["docx", "html", "json", "logs", "config"]
folders = ["books/epub", "books/docx", "books/html", "books/json", "logs", "config"]
folder_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
folders = [os.path.join(folder_path, folder) for folder in folders]
try:
for folder in folders:
check_dir(folder)
[check_dir(folder) for folder in folders]
except OSError as exc:
print(exc)
raise