Skip to content

Instantly share code, notes, and snippets.

@devnoot
Created November 15, 2024 01:46
Show Gist options
  • Save devnoot/19fed924c7a36f68e44aa24b5b98ad90 to your computer and use it in GitHub Desktop.
Save devnoot/19fed924c7a36f68e44aa24b5b98ad90 to your computer and use it in GitHub Desktop.
This Python script can be used to intialize a Doom mod project
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