Fix full sync on Windows

From <https://docs.python.org/3.7/library/os.html#os.rename>:
> On Windows, if dst already exists, OSError will be raised even if
> it is a file.
...
> If you want cross-platform overwriting of the destination, use
> replace().

Thanks to kerry liu (https://github.com/hqzxjczx) for reporting this.

Fixes #32.
This commit is contained in:
flan 2019-04-16 19:50:27 +02:00
parent b9a1203491
commit 7ef3d4f3fa

View File

@ -25,7 +25,7 @@ class FullSyncManager:
# Overwrite existing db.
col.close()
try:
os.rename(temp_db_path, session.get_collection_path())
os.replace(temp_db_path, session.get_collection_path())
finally:
col.reopen()
col.load()