Corrected various JSON read and write issues; modpack install is now created, but folder contents appear to be overridden on launch...

This commit is contained in:
harmacist 2021-03-02 22:58:44 -06:00
parent f8b29945e1
commit c954f45715

View File

@ -63,7 +63,7 @@ def main(modpack_path):
logging.info(f"Modpack {modpack_name} ({modpack_id}) not found in install list - creating...")
install_list[modpack_id] = {
'created': datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z',
'gameDir': install_path,
'gameDir': str(install_path),
'icon': 'Redstone_Block',
'javaArgs': '-Xmx4G '
'-XX:+UnlockExperimentalVMOptions '
@ -80,7 +80,7 @@ def main(modpack_path):
full_profile_setup = json.load(f)
with open(get_minecraft_folder(sys_root) / 'launcher_profiles.json', 'w') as f:
full_profile_setup['profiles'] = install_list
json.dump(full_profile_setup, f)
json.dump(full_profile_setup, f, indent=2)
logging.info(f"Successfully added mod to installed profile list.")
# Validate file structure compared to mod zip
@ -92,4 +92,6 @@ def main(modpack_path):
if __name__ == '__main__':
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
main(PurePath() / 'testing_data' / 'FusterCluck_test.zip')