Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ValveSoftware/Proton.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/proton
diff options
context:
space:
mode:
authorRĂ©mi Bernon <rbernon@codeweavers.com>2021-12-16 13:34:07 +0300
committerArkadiusz Hiler <ahiler@codeweavers.com>2022-01-19 12:29:54 +0300
commit16b662a0bfd0613e37ee71876d4518af5e7b64bb (patch)
tree6889b4f35add1f484c6526aa95671a42c146fb0d /proton
parent212cbc0c9aa00dfa201b3ab1c28009096186448d (diff)
proton: Always set dst to the target file name in try_copy.
Diffstat (limited to 'proton')
-rwxr-xr-xproton15
1 files changed, 6 insertions, 9 deletions
diff --git a/proton b/proton
index f4b467e3..35baffdb 100755
--- a/proton
+++ b/proton
@@ -112,13 +112,10 @@ def merge_user_dir(src, dst):
def try_copy(src, dst, add_write_perm=True, copy_metadata=False, optional=False, follow_symlinks=True):
try:
if os.path.isdir(dst):
- dstfile = dst + "/" + os.path.basename(src)
- if os.path.lexists(dstfile):
- os.remove(dstfile)
- else:
- dstfile = dst
- if os.path.lexists(dst):
- os.remove(dst)
+ dst = os.path.join(dst, os.path.basename(src))
+
+ if os.path.lexists(dst):
+ os.remove(dst)
if copy_metadata:
shutil.copy2(src, dst, follow_symlinks=follow_symlinks)
@@ -126,8 +123,8 @@ def try_copy(src, dst, add_write_perm=True, copy_metadata=False, optional=False,
shutil.copy(src, dst, follow_symlinks=follow_symlinks)
if add_write_perm:
- new_mode = os.lstat(dstfile).st_mode | stat.S_IWUSR | stat.S_IWGRP
- os.chmod(dstfile, new_mode)
+ new_mode = os.lstat(dst).st_mode | stat.S_IWUSR | stat.S_IWGRP
+ os.chmod(dst, new_mode)
except FileNotFoundError as e:
if optional: