Fix issue on windows where source files were removed before transfer.

pull/130/head
Broque Thomas 3 months ago
parent 35e65b2106
commit 60fdf4c82c

@ -8183,6 +8183,17 @@ def _safe_move_file(src, dst):
src = Path(src)
dst = Path(dst)
# Ensure parent directory exists
dst.parent.mkdir(parents=True, exist_ok=True)
# On Windows, shutil.move fails with FileExistsError if destination exists.
# Remove it first to prevent the error chain.
if dst.exists():
try:
dst.unlink()
except Exception:
pass # If we can't remove it, let shutil.move handle the error
try:
# Try standard move first (works if same filesystem)
shutil.move(str(src), str(dst))

Loading…
Cancel
Save