This commit is contained in:
Kelvin Sherlock 2020-08-01 23:00:19 -04:00
parent 895957c14b
commit 5e5db6d667
2 changed files with 22 additions and 4 deletions

23
cli.py
View File

@ -3,6 +3,7 @@ import sys
import io
import argparse
import time
from open_rfork import open_rfork
from base import rObject
@ -60,14 +61,30 @@ if __name__ == '__main__':
opts = p.parse_args()
df = opts.df or not sys.platform in ("win32", "darwin")
scope = rez_scope()
errors = 0
for f in opts.files:
ok = execute(f, scope)
if not ok: errors += 1
if errors > 0 : sys.exit(1)
print("/* Generated on {} */".format(time.ctime()))
print('#include "types.rez"\n')
rObject.dump_rez()
if not opts.o: opts.rez = True
if df or opts.rez:
open_rfork = io.open
if opts.rez:
print("/* Generated on {} */".format(time.ctime()))
print('#include "types.rez"\n')
rObject.dump_rez()
else:
with open_rfork(opts.o, "wb") as io:
rObject.save_resources(io)
rObject.dump_exports()
sys.exit(0)

View File

@ -1,5 +1,6 @@
from enum import Enum, Flag
from itertools import groupby
import struct
class rTypes(Enum):
rIcon = 0x8001 # Icon type