1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-13 18:50:53 +00:00

Use shutil.move in export_storage

os.rename doesn't work when the two folders are on different partitions. shutil.move calls os.rename when possible.
This commit is contained in:
Guillaume Ayoub 2017-05-29 17:58:09 +02:00 committed by GitHub
parent d5171958ff
commit 8b7c7ba214

View file

@ -26,6 +26,7 @@ from a python programme with ``radicale.__main__.run()``.
import atexit
import os
import shutil
import sys
import optparse
import signal
@ -90,7 +91,7 @@ def export_storage(config, path):
with open(component_filename, "wb") as f:
f.write(text.encode("utf-8"))
try:
os.rename(os.path.join(temp, "root"), path)
shutil.move(os.path.join(temp, "root"), path)
except OSError as e:
print("ERROR: Can't create '%s' directory: %s" % (path, e))
exit(1)