Version from filename to pack.toml

Thanks, Ultrasonic! Fixes #222
This commit is contained in:
Madis 2022-01-19 21:18:27 +02:00
parent d6e33b0da3
commit fefdf9e545
3 changed files with 15 additions and 2 deletions

View file

@ -1,5 +1,7 @@
import os
from zipfile import ZipFile
from pathlib import Path
import toml # pip install toml
user_path = os.path.expanduser("~")
git_path = user_path + "/Documents/GitHub/fabulously-optimized/"
@ -7,6 +9,7 @@ minecraft_version = "1.18.1"
packwiz_path = git_path + "Packwiz/" + minecraft_version + "/"
packwiz_exe_path = "..\packwiz.exe"
mods_path = packwiz_path + "mods"
packwiz_manifest = "pack.toml"
refresh_only = False
is_legacy = False
@ -27,6 +30,16 @@ if refresh_only == False:
os.chdir(packwiz_path)
if refresh_only == False:
cf_zip_path = input("Please drag the Curseforge zip file here: ")[3:][:-1] # Because dragging the file adds "& " and double quotes
# Update pack.toml first
pack_version = str(Path(cf_zip_path).with_suffix("")).split("-")[1:][0]
with open(packwiz_manifest, "r") as f:
pack_toml = toml.load(f)
pack_toml["version"] = pack_version
with open(packwiz_manifest, "w") as f:
toml.dump(pack_toml, f)
# Packwiz import
os.system(packwiz_exe_path + " curseforge import \"" + cf_zip_path + "\"")
if is_legacy:
os.system(packwiz_exe_path + " remove hydrogen")

View file

@ -1,5 +1,5 @@
name = "Fabulously Optimized"
version = "1.11.2"
version = "1.12.0"
pack-format = "packwiz:1.0.0"
[index]

View file

@ -1,5 +1,5 @@
name = "Fabulously Optimized"
version = "2.6.2"
version = "2.7.0"
pack-format = "packwiz:1.0.0"
[index]