diff options
author | Andrew Eikum <aeikum@codeweavers.com> | 2022-02-09 20:11:11 +0300 |
---|---|---|
committer | Andrew Eikum <aeikum@codeweavers.com> | 2022-03-14 18:22:16 +0300 |
commit | 63b32e09f6cff689059f23122d52661212ac1041 (patch) | |
tree | 9176f68a435ba545972c8cc8db6326c8485ad964 | |
parent | bc57d557cfef9823339965e47cc7623a25962ceb (diff) |
proton: Better handle broken symlinksproton-5.13-6dproton_5.13
-rwxr-xr-x | proton | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -69,6 +69,9 @@ def file_is_wine_builtin_dll(path): def makedirs(path): 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) except OSError: #already exists @@ -229,7 +232,7 @@ class CompatData: dirs = [] for f in tracked_files: 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): os.remove(path) else: @@ -342,7 +345,7 @@ class CompatData: rel_dir = rel_dir + "/" dst_dir = src_dir.replace(g_proton.default_pfx_dir, self.prefix_dir, 1) if not file_exists(dst_dir, follow_symlinks=True): - os.makedirs(dst_dir) + makedirs(dst_dir) tracked_files.write(rel_dir + "\n") for dir_ in dirs: src_file = os.path.join(src_dir, dir_) @@ -369,7 +372,7 @@ class CompatData: rel_dir = rel_dir + "/" dst_dir = src_dir.replace(g_proton.default_pfx_dir, self.prefix_dir, 1) if not file_exists(dst_dir, follow_symlinks=True): - os.makedirs(dst_dir) + makedirs(dst_dir) tracked_files.write(rel_dir + "\n") for file_ in files: src_file = os.path.join(src_dir, file_) @@ -771,7 +774,7 @@ class Session: basedir = self.env.get("PROTON_LOG_DIR", os.environ["HOME"]) makedirs(basedir) 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) self.log_file = open(lfile_path, "w+") self.log_file.write("======================\n") |