Skip to content

Commit 0baf6b6

Browse files
authored
feat(win): use shutil.move for cross-disk write on Windows (agentscope-ai#1483)
1 parent c4dd5f1 commit 0baf6b6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/copaw/app/crons/repo/json_repo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import annotations
33

44
import json
5+
import shutil
56
from pathlib import Path
67

78
from .base import BaseJobRepository
@@ -40,4 +41,4 @@ async def save(self, jobs_file: JobsFile) -> None:
4041
json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True),
4142
encoding="utf-8",
4243
)
43-
tmp_path.replace(self._path)
44+
shutil.move(str(tmp_path), str(self._path))

src/copaw/app/runner/repo/json_repo.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import json
6+
import shutil
67
from pathlib import Path
78

89
from .base import BaseChatRepository
@@ -65,5 +66,5 @@ async def save(self, chats_file: ChatsFile) -> None:
6566
encoding="utf-8",
6667
)
6768

68-
# Atomic replace
69-
tmp_path.replace(self._path)
69+
# Atomic replace (shutil.move handles cross-disk on Windows)
70+
shutil.move(str(tmp_path), str(self._path))

0 commit comments

Comments
 (0)