Replaced os.rename with atomic os.replace

This should eliminate last problems with file locks on Windows
This commit is contained in:
Paweł Jastrzębski
2014-02-13 18:35:17 +01:00
parent 9a691c3c63
commit 7ebcccd8a2
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -673,7 +673,7 @@ def sanitizeTree(filetree):
newKey = os.path.join(root, slugified + splitname[1])
key = os.path.join(root, name)
if key != newKey:
os.rename(key, newKey)
os.replace(key, newKey)
for name in dirs:
if name.startswith('.'):
os.remove(os.path.join(root, name))
@@ -686,7 +686,7 @@ def sanitizeTree(filetree):
newKey = os.path.join(root, slugified)
key = os.path.join(root, name)
if key != newKey:
os.rename(key, newKey)
os.replace(key, newKey)
return chapterNames