Minecraft client: more general search for mod name

This commit is contained in:
espeon65536 2021-12-19 13:27:40 -05:00 committed by Fabian Dill
parent 9172cc4925
commit 3ee4be2e33
1 changed files with 3 additions and 5 deletions

View File

@ -35,12 +35,10 @@ def prompt_yes_no(prompt):
def find_ap_randomizer_jar(forge_dir): def find_ap_randomizer_jar(forge_dir):
mods_dir = os.path.join(forge_dir, 'mods') mods_dir = os.path.join(forge_dir, 'mods')
if os.path.isdir(mods_dir): if os.path.isdir(mods_dir):
ap_mod_re = re.compile(r"^aprandomizer-[\d\.]+\.jar$")
for entry in os.scandir(mods_dir): for entry in os.scandir(mods_dir):
match = ap_mod_re.match(entry.name) if entry.name.startswith("aprandomizer") and entry.name.endswith(".jar"):
if match: logging.info(f"Found AP randomizer mod: {entry.name}")
logging.info(f"Found AP randomizer mod: {match.group()}") return entry.name
return match.group()
return None return None
else: else:
os.mkdir(mods_dir) os.mkdir(mods_dir)