From: Daira Hopwood Date: Tue, 2 Jun 2015 01:09:25 +0000 (+0100) Subject: fileutil: make the error behaviour of replace_file on Unix more similar to Windows. X-Git-Url: https://git.rkrishnan.org/reedownlee?a=commitdiff_plain;h=1cc444edf31cb8da2a6681896158e47696e82542;p=tahoe-lafs%2Ftahoe-lafs.git fileutil: make the error behaviour of replace_file on Unix more similar to Windows. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/util/fileutil.py b/src/allmydata/util/fileutil.py index 8681c29d..6d7e596a 100644 --- a/src/allmydata/util/fileutil.py +++ b/src/allmydata/util/fileutil.py @@ -630,6 +630,8 @@ else: precondition_abspath(replacement_path) precondition_abspath(backup_path) + if not os.path.exists(replacement_path): + raise ConflictError("Replacement file not found: %r" % (replacement_path,)) try: os.rename(replaced_path, backup_path) rename_no_overwrite(replacement_path, replaced_path)