aboutsummaryrefslogtreecommitdiff
path: root/update.py
diff options
context:
space:
mode:
authorAlexander Hayden <alexhayden25@gmail.com>2019-02-03 10:38:05 -0500
committerAlexander Hayden <alexhayden25@gmail.com>2019-02-03 10:38:05 -0500
commitc1f19c1d20076dab99ef7bf40b88288b04a8d019 (patch)
tree82966a2d4555317ac0ad7fc97aedde6bc59d7201 /update.py
parent64005e550e2933a46aa2a12e9c8858943800b8e0 (diff)
downloadmodpackman-c1f19c1d20076dab99ef7bf40b88288b04a8d019.tar.gz
modpackman-c1f19c1d20076dab99ef7bf40b88288b04a8d019.zip
kill reliquery and add whitelist.txt
Diffstat (limited to 'update.py')
-rwxr-xr-xupdate.py10
1 files changed, 9 insertions, 1 deletions
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")