Files
dusk/tools/assetstool/assets.py
2025-08-25 10:16:55 -05:00

40 lines
1006 B
Python

import sys, os
from args import inputAssets, args
from processasset import processAsset
from assethelpers import getBuiltAssetsRelativePath
import zipfile
# Setup headers directory.
# setOutputDir(args.output)
# outputHeaders = []
# # Create output directory if it doesn't exist
# if not os.path.exists(args.output):
# os.makedirs(args.output)
files = []
for asset in inputAssets:
asset = processAsset(asset)
files.extend(asset['files'])
# Take assets and add to a zip archive.
outputFileName = args.output_file
print(f"Creating output file: {outputFileName}")
with zipfile.ZipFile(outputFileName, 'w') as zipf:
for file in files:
relativeOutputPath = getBuiltAssetsRelativePath(file)
zipf.write(file, arcname=relativeOutputPath)
# Finalize build
if args.build_type == 'header':
print("Error: Header build not implemented yet.")
sys.exit(1)
elif args.build_type == 'wad':
# Nothing to do, already created above!
pass
else:
print("Error: Unknown build type.")
sys.exit(1)