You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/opencode/src/file/time.ts
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
import{Instance}from"../project/instance"
2
2
import{Log}from"../util/log"
3
3
import{Flag}from"../flag/flag"
4
+
import{Filesystem}from"../util/filesystem"
4
5
5
6
exportnamespaceFileTime{
6
7
constlog=Log.create({service: "file.time"})
@@ -59,10 +60,10 @@ export namespace FileTime {
59
60
60
61
consttime=get(sessionID,filepath)
61
62
if(!time)thrownewError(`You must read file ${filepath} before overwriting it. Use the Read tool first`)
62
-
conststats=awaitBun.file(filepath).stat()
63
-
if(stats.mtime.getTime()>time.getTime()){
63
+
constmtime=Filesystem.stat(filepath)?.mtime
64
+
if(mtime&&mtime.getTime()>time.getTime()){
64
65
thrownewError(
65
-
`File ${filepath} has been modified since it was last read.\nLast modification: ${stats.mtime.toISOString()}\nLast read: ${time.toISOString()}\n\nPlease read the file again before modifying it.`,
66
+
`File ${filepath} has been modified since it was last read.\nLast modification: ${mtime.toISOString()}\nLast read: ${time.toISOString()}\n\nPlease read the file again before modifying it.`,
0 commit comments