mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
tools: assetmgr: move --raw-out into a separate function
This commit is contained in:
1 parent
eef42a1e3e
commit
b2cb5c1737
1 file changed
+10
-8
@@ -45,17 +45,19 @@ def write_enums(typename, names, filename, terminator, start=0):
|
||||
|
||||
fd.close()
|
||||
|
||||
def write_data(data):
|
||||
idx = sys.argv.index('--raw-out')
|
||||
filename = sys.argv[idx + 1]
|
||||
print('writing binary to', filename)
|
||||
fd = open(filename, 'wb')
|
||||
fd.write(data)
|
||||
fd.close()
|
||||
|
||||
def write_object(data, filename):
|
||||
if '--raw-out' in sys.argv:
|
||||
# write the raw data into a user-specified file instead
|
||||
idx = sys.argv.index('--raw-out')
|
||||
if idx + 1 < len(sys.argv):
|
||||
filename = sys.argv[idx + 1]
|
||||
fd = open(filename, 'wb')
|
||||
fd.write(data)
|
||||
fd.close()
|
||||
print('wrote binary to', filename)
|
||||
return
|
||||
write_data(data)
|
||||
return
|
||||
|
||||
filename = 'build/%s/assets/%s' % (os.environ['ROMID'], filename)
|
||||
mkpath(filename)
|
||||
|
||||
Reference in new issue
Block a user