فهرست منبع

repository: use os.replace instead of os.rename

On Windows, os.rename raises an exception if the destination file already exists, unlike os.replace which replaces the destination file.

Docs:
https://docs.python.org/3/library/os.html#os.rename
https://docs.python.org/3/library/os.html#os.replace
Rayyan Ansari 2 سال پیش
والد
کامیت
6a97e936ac
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      src/borg/repository.py

+ 1 - 1
src/borg/repository.py

@@ -613,7 +613,7 @@ class Repository:
             os.fsync(fd.fileno())
 
         def rename_tmp(file):
-            os.rename(file + '.tmp', file)
+            os.replace(file + ".tmp", file)
 
         hints = {
             b'version': 2,