Fixed crash when arguments ending with a slash are given to enable, disable, and toggle.

This commit is contained in:
Patrick Marsee 2023-01-30 23:56:49 -05:00
parent fa6f4e7a63
commit 1dfe472a57

View file

@ -314,6 +314,7 @@ def command_list(args: list, cfg: Config, profiles: ModProfiles):
print(f"Usage: {args[0]} {args[1]} [profiles]") print(f"Usage: {args[0]} {args[1]} [profiles]")
def command_enable(args: list, cfg: Config, profiles: ModProfiles): def command_enable(args: list, cfg: Config, profiles: ModProfiles):
args = [a.rstrip("/") for a in args]
for mod in args[2:]: for mod in args[2:]:
if not mod in ("-a", "-A", "*"): if not mod in ("-a", "-A", "*"):
enable_mod(cfg, mod) enable_mod(cfg, mod)
@ -326,6 +327,7 @@ def command_enable(args: list, cfg: Config, profiles: ModProfiles):
break break
def command_disable(args: list, cfg: Config, profiles: ModProfiles): def command_disable(args: list, cfg: Config, profiles: ModProfiles):
args = [a.rstrip("/") for a in args]
for mod in args[2:]: for mod in args[2:]:
if not mod in ("-a", "-A", "*"): if not mod in ("-a", "-A", "*"):
disable_mod(cfg, mod) disable_mod(cfg, mod)
@ -336,6 +338,7 @@ def command_disable(args: list, cfg: Config, profiles: ModProfiles):
break break
def command_toggle(args: list, cfg: Config, profiles: ModProfiles): def command_toggle(args: list, cfg: Config, profiles: ModProfiles):
args = [a.rstrip("/") for a in args]
for mod in args[2:]: for mod in args[2:]:
toggle_mod(cfg, mod) toggle_mod(cfg, mod)