From fd829b50542e1d0e6282f2663fc40a3d49779d39 Mon Sep 17 00:00:00 2001 From: Spencer Brown Date: Sun, 10 Jul 2022 14:17:09 +1000 Subject: [PATCH] Fix #1799: Add a special warning if BEE is installed directly into the game folder. --- src/BEE2_launch.pyw | 9 ++++++++- src/app/gameMan.py | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/BEE2_launch.pyw b/src/BEE2_launch.pyw index 1e39df2b8..2df0b3bef 100644 --- a/src/BEE2_launch.pyw +++ b/src/BEE2_launch.pyw @@ -50,7 +50,14 @@ if __name__ == '__main__': import localisation localisation.setup(LOGGER) - if app_name == 'bee2': + # Check early on for a common mistake - putting the BEE2 folder directly in Portal 2 means + # when we export we'll try and overwrite ourself. Use Steam's appid file as a marker. + if utils.install_path('../steam_appid.txt').exists() and utils.install_path('.').name.casefold() == 'bee2': + from app import gameMan + gameMan.app_in_game_error() + sys.exit() + + elif app_name == 'bee2': from app import BEE2 BEE2.start_main() elif app_name == 'backup': diff --git a/src/app/gameMan.py b/src/app/gameMan.py index 93db6142e..bd68e144b 100644 --- a/src/app/gameMan.py +++ b/src/app/gameMan.py @@ -1263,6 +1263,20 @@ def logic_pos() -> Iterator[Vec]: ) +def app_in_game_error() -> None: + """Display a message warning about the issues with placing the BEE folder directly in P2.""" + messagebox.showerror( + message=gettext( + "It appears that the BEE2 application was installed directly in a game directory. " + "The bee2/ folder name is used for exported resources, so this will cause issues.\n\n" + "Move the application folder elsewhere, then re-run." + ), + parent=TK_ROOT, + title='BEE2', + ) + return None + + def save() -> None: for gm in all_games: gm.save()