diff options
Diffstat (limited to 'update.py')
-rwxr-xr-x | update.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -33,6 +33,10 @@ parser.add_argument('--version-file', parser.add_argument('--pack-location', type=str, help="Optional custom modpack folder location (default: read from pack-location.txt)") +parser.add_argument('--whitelist-file', + type=str, + default="whitelist.txt", + help="Optional custom whitelist file that tells 'install' which files not to remove (default: whitelist.txt)") ## loaded from version.txt VERSION = 0 @@ -56,6 +60,8 @@ def install(args): # (fname, checksum, url) mods = read_file(args.version_file) names = [mod[0] for mod in mods] + # whitelist client mods (e.g. optifine) + names += [line[0] for line in read_file(args.whitelist_file)] for mod in mods: mod_path = os.path.join(args.pack_location, mod[0]) @@ -71,7 +77,6 @@ def install(args): print() print("Removing old mods...") - for jar in os.listdir(args.pack_location): if jar not in names and os.path.splitext(jar)[1] == ".jar": os.remove(os.path.join(args.pack_location, jar)) @@ -146,6 +151,9 @@ if __name__ == "__main__": print("Error: mod folder \"" + args.pack_location + "\" is not actually a folder.") parser.print_help() sys.exit(1) + if not os.path.exists(args.whitelist_file): + print("Error: whitelist file \"" + args.whitelist_file + "\" does not exist.") + sys.exit(1) if not (args.command in COMMAND_MAP): print("Error: command \"" + args.command + "\" does not exist") |