mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-01-13 23:28:16 +03:00
proton: Better handle broken symlinks
This commit is contained in:
parent
90a11aca8e
commit
17683bff97
23
proton
23
proton
@ -89,6 +89,9 @@ def file_is_wine_builtin_dll(path):
|
|||||||
|
|
||||||
def makedirs(path):
|
def makedirs(path):
|
||||||
try:
|
try:
|
||||||
|
#replace broken symlinks with a new directory
|
||||||
|
if os.path.islink(path) and not file_exists(path, follow_symlinks=True):
|
||||||
|
os.remove(path)
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
except OSError:
|
except OSError:
|
||||||
#already exists
|
#already exists
|
||||||
@ -405,7 +408,7 @@ class CompatData:
|
|||||||
dirs = []
|
dirs = []
|
||||||
for f in tracked_files:
|
for f in tracked_files:
|
||||||
path = self.prefix_dir + f.strip()
|
path = self.prefix_dir + f.strip()
|
||||||
if file_exists(path, follow_symlinks=True):
|
if file_exists(path, follow_symlinks=False):
|
||||||
if os.path.isfile(path) or os.path.islink(path):
|
if os.path.isfile(path) or os.path.islink(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
else:
|
else:
|
||||||
@ -570,8 +573,8 @@ class CompatData:
|
|||||||
if len(rel_dir) > 0:
|
if len(rel_dir) > 0:
|
||||||
rel_dir = rel_dir + "/"
|
rel_dir = rel_dir + "/"
|
||||||
dst_dir = src_dir.replace(g_proton.default_pfx_dir, self.prefix_dir, 1)
|
dst_dir = src_dir.replace(g_proton.default_pfx_dir, self.prefix_dir, 1)
|
||||||
if not file_exists(dst_dir, follow_symlinks=False):
|
if not file_exists(dst_dir, follow_symlinks=True):
|
||||||
os.makedirs(dst_dir)
|
makedirs(dst_dir)
|
||||||
tracked_files.write(rel_dir + "\n")
|
tracked_files.write(rel_dir + "\n")
|
||||||
for dir_ in dirs:
|
for dir_ in dirs:
|
||||||
src_file = os.path.join(src_dir, dir_)
|
src_file = os.path.join(src_dir, dir_)
|
||||||
@ -602,8 +605,8 @@ class CompatData:
|
|||||||
if len(rel_dir) > 0:
|
if len(rel_dir) > 0:
|
||||||
rel_dir = rel_dir + "/"
|
rel_dir = rel_dir + "/"
|
||||||
dst_dir = src_dir.replace(g_proton.default_pfx_dir, self.prefix_dir, 1)
|
dst_dir = src_dir.replace(g_proton.default_pfx_dir, self.prefix_dir, 1)
|
||||||
if not file_exists(dst_dir, follow_symlinks=False):
|
if not file_exists(dst_dir, follow_symlinks=True):
|
||||||
os.makedirs(dst_dir)
|
makedirs(dst_dir)
|
||||||
tracked_files.write(rel_dir + "\n")
|
tracked_files.write(rel_dir + "\n")
|
||||||
for file_ in files:
|
for file_ in files:
|
||||||
src_file = os.path.join(src_dir, file_)
|
src_file = os.path.join(src_dir, file_)
|
||||||
@ -883,13 +886,13 @@ class CompatData:
|
|||||||
else:
|
else:
|
||||||
nvapi64_dll = self.prefix_dir + "drive_c/windows/system32/nvapi64.dll"
|
nvapi64_dll = self.prefix_dir + "drive_c/windows/system32/nvapi64.dll"
|
||||||
nvapi32_dll = self.prefix_dir + "drive_c/windows/syswow64/nvapi.dll"
|
nvapi32_dll = self.prefix_dir + "drive_c/windows/syswow64/nvapi.dll"
|
||||||
if file_exists(nvapi64_dll, follow_symlinks=True):
|
if file_exists(nvapi64_dll, follow_symlinks=False):
|
||||||
os.unlink(nvapi64_dll)
|
os.unlink(nvapi64_dll)
|
||||||
if file_exists(nvapi64_dll + '.debug', follow_symlinks=True):
|
if file_exists(nvapi64_dll + '.debug', follow_symlinks=False):
|
||||||
os.unlink(nvapi64_dll + '.debug')
|
os.unlink(nvapi64_dll + '.debug')
|
||||||
if file_exists(nvapi32_dll, follow_symlinks=True):
|
if file_exists(nvapi32_dll, follow_symlinks=False):
|
||||||
os.unlink(nvapi32_dll)
|
os.unlink(nvapi32_dll)
|
||||||
if file_exists(nvapi32_dll + '.debug', follow_symlinks=True):
|
if file_exists(nvapi32_dll + '.debug', follow_symlinks=False):
|
||||||
os.unlink(nvapi32_dll + '.debug')
|
os.unlink(nvapi32_dll + '.debug')
|
||||||
|
|
||||||
# Try to detect known DLLs that ship with the NVIDIA Linux Driver
|
# Try to detect known DLLs that ship with the NVIDIA Linux Driver
|
||||||
@ -1032,7 +1035,7 @@ class Session:
|
|||||||
|
|
||||||
lfile_path = basedir + "/steam-" + os.environ["SteamGameId"] + ".log"
|
lfile_path = basedir + "/steam-" + os.environ["SteamGameId"] + ".log"
|
||||||
|
|
||||||
if file_exists(lfile_path, follow_symlinks=True):
|
if file_exists(lfile_path, follow_symlinks=False):
|
||||||
os.remove(lfile_path)
|
os.remove(lfile_path)
|
||||||
|
|
||||||
makedirs(basedir)
|
makedirs(basedir)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user