Created
November 15, 2024 01:46
-
-
Save devnoot/19fed924c7a36f68e44aa24b5b98ad90 to your computer and use it in GitHub Desktop.
This Python script can be used to intialize a Doom mod project
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
import os | |
import sys | |
if __name__ == '__main__': | |
if len(sys.argv) < 2: | |
print("Usage: python3 init_doom_mod /path/to/target/directory") | |
sys.exit(1) | |
target_directory = sys.argv[1] | |
if os.path.exists(target_directory): | |
confirm = input(f"The directory {target_directory} already exists. Do you want to delete it and recreate it? (Y/N): ") | |
if confirm.lower() != 'y': | |
print("Operation cancelled.") | |
sys.exit(1) | |
else: | |
os.rmdir(target_directory) | |
os.makedirs(target_directory) | |
else: | |
os.makedirs(target_directory) | |
subdirectories = ['maps', 'textures', 'sprites', 'sounds', 'music'] | |
for subdirectory in subdirectories: | |
os.makedirs(os.path.join(target_directory, subdirectory)) | |
print(f'Created new mod in {target_directory}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment