Skip to content

Commit 3fb8f53

Browse files
committed
windows
1 parent 7d719e8 commit 3fb8f53

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

packages/opencode/src/cli/cmd/run/session.shared.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// Fetches session messages from the SDK and extracts user turn text for
44
// the prompt history ring. Also finds the most recently used variant for
55
// the current model so the footer can pre-select it.
6-
import path from "path"
7-
import { fileURLToPath } from "url"
86
import { promptCopy, promptSame } from "./prompt.shared"
97
import type { RunInput, RunPrompt } from "./types"
108

@@ -31,8 +29,13 @@ function fileName(url: string, filename?: string) {
3129

3230
try {
3331
const next = new URL(url)
34-
if (next.protocol === "file:") {
35-
return path.basename(fileURLToPath(next)) || url
32+
if (next.protocol !== "file:") {
33+
return url
34+
}
35+
36+
const name = next.pathname.split("/").at(-1)
37+
if (name) {
38+
return decodeURIComponent(name)
3639
}
3740
} catch {}
3841

packages/opencode/src/cli/cmd/run/tool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,14 @@ export function toolPath(input?: string, opts: { home?: boolean } = {}): string
265265
}
266266

267267
if (!rel.startsWith("..")) {
268-
return rel
268+
return rel.replaceAll("\\", "/")
269269
}
270270

271271
if (opts.home && home && (abs === home || abs.startsWith(home + path.sep))) {
272-
return abs.replace(home, "~")
272+
return abs.replace(home, "~").replaceAll("\\", "/")
273273
}
274274

275-
return abs
275+
return abs.replaceAll("\\", "/")
276276
}
277277

278278
function fallbackInline(ctx: ToolFrame): ToolInline {

0 commit comments

Comments
 (0)