Skip to content

Commit

Permalink
util: Use os.path.abspath for is_valid_launcher_installation (#381)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
sonic2kk and DavidoTek authored Apr 23, 2024
1 parent 9f72d6a commit 318e772
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pupgui2/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 318e772

Please sign in to comment.