mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-30 01:38:55 +00:00
replace_file should not fail if replaced_path does not exist.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
472e267075
commit
bfda47fef4
@ -619,7 +619,11 @@ else:
|
||||
if not os.path.exists(replacement_path):
|
||||
raise ConflictError("Replacement file not found: %r" % (replacement_path,))
|
||||
try:
|
||||
os.rename(replaced_path, backup_path)
|
||||
try:
|
||||
os.rename(replaced_path, backup_path)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
rename_no_overwrite(replacement_path, replaced_path)
|
||||
except EnvironmentError:
|
||||
reraise(ConflictError)
|
||||
|
Loading…
Reference in New Issue
Block a user