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:
parent
d5171958ff
commit
8b7c7ba214
1 changed files with 2 additions and 1 deletions
|
@ -26,6 +26,7 @@ from a python programme with ``radicale.__main__.run()``.
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import optparse
|
import optparse
|
||||||
import signal
|
import signal
|
||||||
|
@ -90,7 +91,7 @@ def export_storage(config, path):
|
||||||
with open(component_filename, "wb") as f:
|
with open(component_filename, "wb") as f:
|
||||||
f.write(text.encode("utf-8"))
|
f.write(text.encode("utf-8"))
|
||||||
try:
|
try:
|
||||||
os.rename(os.path.join(temp, "root"), path)
|
shutil.move(os.path.join(temp, "root"), path)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print("ERROR: Can't create '%s' directory: %s" % (path, e))
|
print("ERROR: Can't create '%s' directory: %s" % (path, e))
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue