From 101dab0ea408bac06b4fed5973ad87321603cd13 Mon Sep 17 00:00:00 2001 From: SoldierofOrder <107806872+SoldierofOrder@users.noreply.github.com> Date: Sun, 18 Sep 2022 10:48:36 -0400 Subject: [PATCH] SC2: Add helpful feedback when failing to locate SC2 (#1032) * SC2: The client now throws a descriptive error when ExecuteInfo.txt exists but is empty, and offers more helpful suggestions when the file doesn't exist. * SC2: Replaced the new RuntimeError with a warning in the logger to keep things consistent. * Removed communism Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> --- Starcraft2Client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Starcraft2Client.py b/Starcraft2Client.py index 09e4db8b..d91adffb 100644 --- a/Starcraft2Client.py +++ b/Starcraft2Client.py @@ -793,7 +793,12 @@ def check_game_install_path() -> bool: with open(einfo) as f: content = f.read() if content: - base = re.search(r" = (.*)Versions", content).group(1) + try: + base = re.search(r" = (.*)Versions", content).group(1) + except AttributeError: + sc2_logger.warning(f"Found {einfo}, but it was empty. Run SC2 through the Blizzard launcher, then " + f"try again.") + return False if os.path.exists(base): executable = sc2.paths.latest_executeble(Path(base).expanduser() / "Versions") @@ -810,7 +815,8 @@ def check_game_install_path() -> bool: else: sc2_logger.warning(f"{einfo} pointed to {base}, but we could not find an SC2 install there.") else: - sc2_logger.warning(f"Couldn't find {einfo}. Please run /set_path with your SC2 install directory.") + sc2_logger.warning(f"Couldn't find {einfo}. Run SC2 through the Blizzard launcher, then try again. " + f"If that fails, please run /set_path with your SC2 install directory.") return False