Skip to content

Commit

Permalink
properly overwrite, even on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
meejah committed Jun 3, 2024
1 parent a4dedc2 commit 5e7c4c9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/magic_folder/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,13 @@ def mark_not_conflicted(self, relpath, keep_path, rejected_paths):
for p in rejected_paths
]
if dest_path != src_path:
src_path.moveTo(dest_path)
try:
src_path.moveTo(dest_path)
except FileExistsError:
# at least on Windows, it's an error to write to a
# file that's already there ..
src_path.remove()
src_path.moveTo(dest_path)
for p in del_paths:
try:
p.remove()
Expand Down

0 comments on commit 5e7c4c9

Please sign in to comment.