fix: move tree.json output to parent folder

Signed-off-by: Bjorn Lammers <bjorn@lammers.media>
This commit is contained in:
Bjorn Lammers 2025-01-05 01:07:39 +01:00 committed by GitHub
parent 118b13aac3
commit a0fddd586c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,11 +27,11 @@ if __name__ == "__main__":
# Generate the combined folder tree # Generate the combined folder tree
folder_tree = generate_folder_tree(folder_paths) folder_tree = generate_folder_tree(folder_paths)
# Write the JSON structure to 'tree.json' in the root folder # Write the JSON structure to 'tree.json' in the parent folder
root_dir = Path(__file__).resolve().parent root_dir = Path(__file__).resolve().parent
tree_json_path = root_dir / 'tree.json' tree_json_path = root_dir.parent / 'tree.json'
with open(tree_json_path, 'w') as f: with open(tree_json_path, 'w') as f:
json.dump(folder_tree, f, indent=4, sort_keys=True) # Sort the keys in the JSON output json.dump(folder_tree, f, indent=4, sort_keys=True) # Sort the keys in the JSON output
print(f"Folder tree successfully written to '{tree_json_path}'.") print(f"Folder tree successfully written to '{tree_json_path}'.")