From 6a44a7041f6d123b5e1d338e1977d8a6dee52e24 Mon Sep 17 00:00:00 2001 From: RodrigoDornelles Date: Thu, 26 Oct 2023 21:25:06 -0300 Subject: [PATCH] build: fix dir in build-pwa.py --- build-pwa.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build-pwa.py b/build-pwa.py index bcffb14..ac95c58 100755 --- a/build-pwa.py +++ b/build-pwa.py @@ -2,11 +2,16 @@ from base64 import b64encode as b64 import requests import sys +import os title = 'Coco Battle Royale II' input = './bin/cocobattleroyale.nes' output = './html/usa.html' + +if not os.path.exists('html'): + os.mkdir('html') + if '--jap' in sys.argv: title = 'Kokobatoru 2' input = './bin/kokobatoru.nes' @@ -17,7 +22,7 @@ cdn = 'https://cdn.jsdelivr.net/gh/takahirox/nes-js@v0.0.1/build' with requests.get(f'{cdn}/{file_name}', stream=True) as download: file_name = file_name.replace(r'.min.js', '.js') - open(f'./html/{file_name}', "x").write(download.text) + open(f'./html/{file_name}', "w+").write(download.text) rom = b64(open(input, "rb").read()).decode() html = open("./res/index.html", "r").read()