WiiDuktape/source/assets/asset_generator.py
Fries 63bb2916ca move duktape code into a static library.
this means i can try out making a launcher that launches into other
javascript engines like quickjs.
2024-06-25 14:08:04 -07:00

20 lines
388 B
Python
Executable file

#!/usr/bin/env python3
from pathlib import Path
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("input")
parser.add_argument("output")
args = parser.parse_args()
script = Path(args.input).read_text().replace("\n", "\\n").replace('"', '\\"')
code = f"""#include <game.h>
const char * program = "{script}";
"""
with open(args.output, 'w') as f:
f.write(code)