fileutil: make the error behaviour of replace_file on Unix more similar to Windows.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
3cffe2599e
commit
a2cb04fe7d
|
@ -615,6 +615,8 @@ else:
|
||||||
precondition_abspath(replacement_path)
|
precondition_abspath(replacement_path)
|
||||||
precondition_abspath(backup_path)
|
precondition_abspath(backup_path)
|
||||||
|
|
||||||
|
if not os.path.exists(replacement_path):
|
||||||
|
raise ConflictError("Replacement file not found: %r" % (replacement_path,))
|
||||||
try:
|
try:
|
||||||
os.rename(replaced_path, backup_path)
|
os.rename(replaced_path, backup_path)
|
||||||
rename_no_overwrite(replacement_path, replaced_path)
|
rename_no_overwrite(replacement_path, replaced_path)
|
||||||
|
|
Loading…
Reference in New Issue