From 16a4a8fd7e962e624e4a9e4aa997cbbe52393202 Mon Sep 17 00:00:00 2001 From: Bjorn Lammers Date: Sun, 20 Oct 2024 12:13:29 +0200 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=90=9B=20Generate=20file=20if=20it=20d?= =?UTF-8?q?oesn't=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjorn Lammers --- config/tree.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/tree.py b/config/tree.py index aa0d80a1..f0110a7e 100644 --- a/config/tree.py +++ b/config/tree.py @@ -39,6 +39,11 @@ if __name__ == "__main__": print("Please provide at least one folder path.") sys.exit(1) + # Check if 'tree.json' exists + if os.path.exists('tree.json'): + print("'tree.json' already exists. No file was created.") + sys.exit(0) + # Generate the combined folder tree for all specified paths combined_folder_tree = generate_combined_tree(folder_paths) @@ -46,4 +51,4 @@ if __name__ == "__main__": with open('tree.json', 'w') as f: json.dump(combined_folder_tree, f, indent=4) - print("Folder tree successfully written to 'tree.json'.") \ No newline at end of file + print("Folder tree successfully written to 'tree.json'.")