mirror of
https://github.com/a2-4am/4cade.git
synced 2024-10-03 19:55:09 +00:00
28 lines
816 B
Python
Executable File
28 lines
816 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# parameters
|
|
# 1 - input file
|
|
# 2 - output filename for data file
|
|
# stdout - source code of index record
|
|
|
|
import argparse
|
|
import os.path
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(description="Append file to TOTAL.DATA and calculate its index record")
|
|
parser.add_argument("input_file")
|
|
parser.add_argument("output_file")
|
|
args = parser.parse_args()
|
|
offset = os.path.getsize(args.output_file)
|
|
size = os.path.getsize(args.input_file)
|
|
with open(args.input_file, 'rb') as input_handle, open(args.output_file, 'ab') as output_handle:
|
|
output_handle.write(input_handle.read())
|
|
print(f""";
|
|
; Index record for {args.input_file}
|
|
;
|
|
; This file is automatically generated
|
|
;
|
|
!byte 0
|
|
!be24 {offset:>9}
|
|
!le16 {size:>8}""")
|