diff --git a/.gitignore b/.gitignore index c72d60b7f..1c3165d2a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ index.toml *.log *.txt *.dll -*.exe build/modlist.* config/InvTweaks.cfg diff --git a/README.md b/README.md index 6809d39cc..20a55c101 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,6 @@ Special thanks to our volunteers: - Science Demon • Questbook work, German translation and bug fixes ## Development Tips -> Please download [Packwiz](https://packwiz.infra.link/installation/) to the current directory manually. > [Full Usage - Packwiz Tutorial](https://packwiz.infra.link/tutorials/creating/getting-started/) - Add mod: `packwiz cf add ` ([Full Usage](https://packwiz.infra.link/tutorials/creating/adding-mods/)) - Refresh Hash: `packwiz refresh` @@ -82,7 +81,6 @@ Special thanks to our volunteers: - Client only mod: [rewrite .pw.toml#side manually](https://packwiz.infra.link/reference/pack-format/mod-toml/#properties) ## Building the pack -1. Please download [Packwiz](https://packwiz.infra.link/installation/) to the current directory manually. -2. Run `pip install requests` first to install required package. -3. Run `python build/main.py`. -4. Check `buildOut` folder. \ No newline at end of file +1. Run `pip install requests` first to install required package. +2. Run `python build/main.py`. +3. Check `buildOut` folder. diff --git a/build/main.py b/build/main.py index 42fed18a2..ff6cf7b95 100644 --- a/build/main.py +++ b/build/main.py @@ -3,7 +3,6 @@ """build client & server bundles""" import argparse -# if there is a problem with building, please let htmlcsjs know import os import sys import shutil @@ -49,7 +48,15 @@ def parse_args(): return parser.parse_args() +def packwiz(): + if os.name == 'posix': + subprocess.run(['chmod', '+x', './packwiz'], check=True) + return './packwiz' + if os.name == 'nt': + return 'packwiz.exe' + basePath = os.path.normpath(os.path.realpath(__file__)[:-7] + "..") +packwizName = packwiz() def build(args): # Run questbook.py first @@ -66,18 +73,17 @@ def build(args): export_client_pack() # Client if args.client: - return; + return export_modlist() export_server_pack() def refresh(): - subprocess.run(['chmod', '+x', './packwiz'], check=True) - subprocess.run(['./packwiz', 'refresh'], check=True) + subprocess.run([packwizName, 'refresh'], check=True) def export_client_pack(): print("Client Pack Exporting") - subprocess.run(['./packwiz', 'curseforge', 'export', '-o', 'client.zip'], check=True) + subprocess.run([packwizName, 'curseforge', 'export', '-o', 'client.zip'], check=True) shutil.copy('./client.zip', './buildOut/') os.remove('./client.zip') print("Client Pack Export Done") @@ -103,7 +109,6 @@ def export_server_pack(): for file in ['launch.sh', 'forge-1.12.2-14.23.5.2860.jar', 'LICENSE', 'minecraft_server.1.12.2.jar']: zipf.write(file, file) - os.remove(file) os.chdir("../..") shutil.move(f"build/server/{server_pack}", f"buildOut/{server_pack}") @@ -111,7 +116,7 @@ def export_server_pack(): def export_modlist(): print("Modlist Exporting") - result = subprocess.run(['./packwiz', 'list'], capture_output=True, text=True).stdout.strip().split('\n') + result = subprocess.run([packwizName, 'list'], capture_output=True, encoding='utf-8').stdout.strip().split('\n') with open(basePath + "/buildOut/modlist.html", "w") as file: data = "

Modlist