From c1f19c1d20076dab99ef7bf40b88288b04a8d019 Mon Sep 17 00:00:00 2001 From: Alexander Hayden Date: Sun, 3 Feb 2019 10:38:05 -0500 Subject: kill reliquery and add whitelist.txt --- update.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'update.py') diff --git a/update.py b/update.py index 2622c8b..876d3e4 100755 --- a/update.py +++ b/update.py @@ -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") -- cgit v1.2.3