Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update makedirs function to not supress OSErrors #3404

Open
wants to merge 6 commits into
base: proton_4.11
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions proton
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ def file_is_wine_fake_dll(path):

def makedirs(path):
try:
if os.path.lexists(path):
return

os.makedirs(path)
except OSError:
#already exists
except FileExistsError:
pass

def try_copy(src, dst):
Expand Down Expand Up @@ -165,10 +167,11 @@ class CompatData:
dirs.append(path)
for d in dirs:
try:
os.rmdir(d)
except OSError:
#not empty
pass
if not any(os.scandir(d)):
os.rmdir(d)
except OSError as e:
if e.errno != errno.ENOTEMPTY:
raise

os.remove(self.tracked_files_file)
os.remove(self.version_file)
Expand Down Expand Up @@ -257,7 +260,7 @@ class CompatData:
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):
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_)
Expand Down