Skip to content

Commit

Permalink
Fix full sync on Windows
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tsudoko committed Apr 16, 2019
1 parent b9a1203 commit 7ef3d4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ankisyncd/full_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def upload(self, col, data, session):
# 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()
Expand Down

0 comments on commit 7ef3d4f

Please sign in to comment.