-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
12 changed files
with
80 additions
and
14 deletions.
There are no files selected for viewing
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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,37 @@ | ||
import os | ||
import json | ||
|
||
def collect_files(): | ||
current_dir = os.getcwd() | ||
file_dict = {} | ||
|
||
for filename in os.listdir(current_dir): | ||
if os.path.isfile(filename): | ||
file_path = os.path.join(current_dir, filename) | ||
file_name_without_ext = os.path.splitext(filename)[0] | ||
print(file_name_without_ext) | ||
|
||
if (file_name_without_ext == 'combine' or file_name_without_ext == 'file_contents'): | ||
continue | ||
|
||
try: | ||
with open(file_path, 'r', encoding='utf-8') as file: | ||
file_contents = file.read() | ||
file_dict[file_name_without_ext] = file_contents | ||
except Exception as e: | ||
print(f"Error reading file {filename}: {str(e)}") | ||
|
||
return file_dict | ||
|
||
def create_js_dictionary(file_dict): | ||
js_dict = json.dumps(file_dict, indent=2) | ||
js_output = f"const fileContents = {js_dict};" | ||
|
||
with open('file_contents.js', 'w', encoding='utf-8') as js_file: | ||
js_file.write(js_output) | ||
|
||
print("JavaScript dictionary has been created in 'file_contents.js'") | ||
|
||
if __name__ == "__main__": | ||
file_dict = collect_files() | ||
create_js_dictionary(file_dict) |
Large diffs are not rendered by default.
Oops, something went wrong.