]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
fileutil: make the error behaviour of replace_file on Unix more similar to Windows.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 2 Jun 2015 01:09:25 +0000 (02:09 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 2 Jun 2015 01:09:25 +0000 (02:09 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/util/fileutil.py

index 7902e8b83a7300143416800f5f15a178c0c03867..07c417f9a8b424dae20cc259cb524752001659d9 100644 (file)
@@ -625,6 +625,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)