From 318e77220e4b9ab1a268168010237ea78362ca24 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Tue, 23 Apr 2024 15:30:59 +0100 Subject: [PATCH] util: Use os.path.abspath for is_valid_launcher_installation (#381) * util: Use os.path.abspath for is_valid_launcher_installation If the compatibilitytools.d dir is a symlink, realpath will resolve the symlink before expanding and moving up a directory, meaning we will end up looking for the Steam data files in the symlink's parent directory instead of the Steam root, as we assumed the parent folder of compatibilitytools.d would always be a Steam root dir. * util, is_valid_launcher_installation: add comment to abspath --------- Co-authored-by: DavidoTek <54072917+DavidoTek@users.noreply.github.com> --- pupgui2/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pupgui2/util.py b/pupgui2/util.py index e91991fa..e6721888 100644 --- a/pupgui2/util.py +++ b/pupgui2/util.py @@ -210,7 +210,10 @@ def is_valid_launcher_installation(loc) -> bool: # # In future we could expand this to other Steam flavours and other launchers. if loc['display_name'] == 'Steam': # This seems to get called many times, why? - return is_valid_steam_install(os.path.realpath(os.path.join(install_dir, '..'))) + # get the parent of the compatibility tools install directory + # use abspath here as install_dir could be a symlink, https://github.com/DavidoTek/ProtonUp-Qt/pull/381 + launcher_root_dir = os.path.abspath(os.path.join(install_dir, '..')) + return is_valid_steam_install(launcher_root_dir) return os.path.exists(install_dir) # Default to path check for all other launchers