diff options
author | Andrew Eikum <aeikum@codeweavers.com> | 2021-08-19 18:12:07 +0300 |
---|---|---|
committer | Andrew Eikum <aeikum@codeweavers.com> | 2021-08-19 18:47:48 +0300 |
commit | b5646c407277c5ff4e01be724f8c420ebcf8422c (patch) | |
tree | 036496ba5920659998dbfa711cd92043190853d2 | |
parent | 0afcb194167b4168a44733fe09cc5eea8f8996be (diff) |
proton: Work around prefixes broken by unofficial buildsproton-6.3-6b
Some unofficial builds running closer to upstream created a Documents ->
My Documents symlink. We would then create a My Documents -> Documents
symlink, resulting in infinite recursion. Detect this scenario and fix
it before merging user directories.
-rwxr-xr-x | proton | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -519,7 +519,7 @@ class CompatData: if len(rel_dir) > 0: rel_dir = rel_dir + "/" dst_dir = src_dir.replace(g_proton.default_pfx_dir, self.prefix_dir, 1) - if not os.path.exists(dst_dir): + if not os.path.lexists(dst_dir): os.makedirs(dst_dir) tracked_files.write(rel_dir + "\n") for dir_ in dirs: @@ -601,16 +601,24 @@ class CompatData: #upgrade_pfx because Steam may drop cloud files here at any time. for (old, new, link) in \ [ - (self.prefix_dir + "drive_c/users/steamuser/Local Settings/Application Data", + ("drive_c/users/steamuser/Local Settings/Application Data", self.prefix_dir + "drive_c/users/steamuser/AppData/Local", "../AppData/Local"), - (self.prefix_dir + "drive_c/users/steamuser/Application Data", + ("drive_c/users/steamuser/Application Data", self.prefix_dir + "drive_c/users/steamuser/AppData/Roaming", "./AppData/Roaming"), - (self.prefix_dir + "drive_c/users/steamuser/My Documents", + ("drive_c/users/steamuser/My Documents", self.prefix_dir + "drive_c/users/steamuser/Documents", "./Documents"), ]: + + #running unofficial Proton/Wine builds against a Proton prefix could + #create an infinite symlink loop. detect this and clean it up. + if os.path.lexists(new) and os.path.islink(new) and os.readlink(new).endswith(old): + os.remove(new) + + old = self.prefix_dir + old + if os.path.lexists(old) and not os.path.islink(old): merge_user_dir(src=old, dst=new) os.rename(old, old + " BACKUP") |