proton: Work around prefixes broken by unofficial builds
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.
This commit is contained in:
parent
0afcb19416
commit
b5646c4072
1 changed files with 12 additions and 4 deletions
16
proton
16
proton
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue