From 27a51e64416bc0ba7139a697ad87d3dfb7aefb13 Mon Sep 17 00:00:00 2001 From: thewhiteh4t Date: Wed, 27 Sep 2023 00:07:31 +0530 Subject: [PATCH] create dir/sub-dir if they dont exist --- settings.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/settings.py b/settings.py index 7e7dd12..3b51dac 100644 --- a/settings.py +++ b/settings.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 -from os import getenv, path +from os import getenv, path, makedirs from json import loads +from shutil import copytree home = getenv('HOME') usr_data = f'{home}/.local/share/finalrecon/dumps/' @@ -14,9 +15,11 @@ log_file_path = f'{home}/.local/share/finalrecon/run.log' if not path.exists(conf_path): - from shutil import copytree copytree(src_conf_path, conf_path, dirs_exist_ok=True) +if not path.exists(usr_data): + makedirs(usr_data, exist_ok=True) + with open(conf_file_path, 'r') as config_file: config_read = config_file.read() config_json = loads(config_read)