Update version.py fixes

This commit is contained in:
Madis 2022-08-22 14:15:14 +03:00
parent 67d99b21ce
commit 331f9fd02d

View file

@ -6,20 +6,22 @@ cf_path = user_path + "/curseforge/minecraft/Instances/Fabulously Optimized/"
title_screen_path = cf_path + "config/isxander-main-menu-credits.json"
warning_path = cf_path + "config/fabric_loader_dependencies.json"
title_screen_obj = json.load(open(title_screen_path))
def load_json(path):
return json.load(open(path))
def save_file(path, obj):
with open(path, "w") as f:
json.dump(obj, f, separators=(',', ':'))
title_screen_obj = load_json(title_screen_path)
existing_version = title_screen_obj["main_menu"]["bottom_right"][0]["text"]
print("Current version: " + existing_version)
new_version = "Fabulously Optimized " + input("Enter new version: Fabulously Optimized ")
new_version = input("Enter new version: Fabulously Optimized ")
title_screen_obj = json.load(open(title_screen_path))
title_screen_obj["main_menu"]["bottom_right"][0]["text"] = new_version
title_screen_obj["main_menu"]["bottom_right"][0]["text"] = "Fabulously Optimized " + new_version
save_file(title_screen_path, title_screen_obj)
warning_file_obj = json.load(open(warning_path))
warning_file_obj["overrides"]["fabric-api"]["+recommends"]["Fabulously Optimized"] = "newer than " + new_version
with open(title_screen_path, "w") as f:
json.dump(title_screen_obj, f, separators=(',', ':'))
with open(warning_path, "w") as f:
json.dump(warning_file_obj, f, separators=(',', ':'))
warning_file_obj = load_json(warning_path)
warning_file_obj["overrides"]["fabric-api"]["+recommends"]["Fabulously Optimized"] = ">" + new_version
save_file(warning_path, warning_file_obj)