Flattener: allow raw resource fork

This commit is contained in:
Elliot Nunn 2021-09-19 19:43:44 +08:00
parent dec9fc4637
commit 22c19bbfdf
1 changed files with 5 additions and 1 deletions

View File

@ -17,7 +17,11 @@ args.rtype = args.rt.partition('=')[0].encode('mac_roman')
args.rid = int(args.rt.partition('=')[2])
with open(args.src, 'rb') as f:
resources = list(macresources.parse_rez_code(f.read(), original_file=f.name))
d = f.read()
if f.name.endswith('.rdump'):
resources = list(macresources.parse_rez_code(d, original_file=f.name))
else:
resources = list(macresources.parse_file(d))
resources = [r for r in resources if r.type == args.rtype and r.id >= args.rid]
resources.sort(key=lambda r: r.id)