generated from theripper93/FoundryVTT-Module-Template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
275c8f2
commit 4bb88d4
Showing
4 changed files
with
5,902 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
import json | ||
|
||
# Define the extensions to include in the crawl | ||
included_extensions = ['glb', 'gltf'] # Add more extensions as needed | ||
|
||
# Function to crawl directory and collect file paths | ||
def crawl_directory(directory): | ||
file_paths = [] | ||
for root, _, files in os.walk(directory): | ||
for file in files: | ||
if any(file.endswith(ext) for ext in included_extensions): | ||
file_paths.append(os.path.relpath(os.path.join(root, file), directory).replace("\\", "/")) | ||
return file_paths | ||
|
||
# Get the directory of the current script file | ||
script_directory = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
# Crawl the script directory and subdirectories | ||
file_paths = crawl_directory(script_directory) | ||
|
||
# Save file paths as JSON | ||
output_file = os.path.join(script_directory, 'index.json') | ||
with open(output_file, 'w') as f: | ||
json.dump(file_paths, f, indent=4) | ||
|
||
print(f"File paths saved to {output_file}") |
Oops, something went wrong.