From b2cb5c1737493c9dbd637ed6f04ead996affe9b3 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Wed, 20 Sep 2023 11:19:36 +0200 Subject: [PATCH] tools: assetmgr: move --raw-out into a separate function --- tools/assetmgr/assetmgr.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/assetmgr/assetmgr.py b/tools/assetmgr/assetmgr.py index 0db3935e3..bfc859057 100644 --- a/tools/assetmgr/assetmgr.py +++ b/tools/assetmgr/assetmgr.py @@ -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)