mirror of
https://github.com/sst/opencode.git
synced 2025-07-07 16:14:59 +00:00
fix: parse file:// URLs correctly on Windows
On Windows, URL.pathname returns a path with an extra leading '/' (e.g. '\C:\Users\whatever'). This causes problems when using Bun.spawn(). Fix these problems by using the right method instead of URL.pathname.
This commit is contained in:
parent
7fa2d78c3d
commit
eb38d11a68
1 changed files with 2 additions and 1 deletions
|
@ -4,6 +4,7 @@ import { Server } from "./server/server"
|
|||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
import { Share } from "./share/share"
|
||||
import url from "node:url"
|
||||
import { Global } from "./global"
|
||||
import yargs from "yargs"
|
||||
import { hideBin } from "yargs/helpers"
|
||||
|
@ -63,7 +64,7 @@ const cli = yargs(hideBin(process.argv))
|
|||
const server = Server.listen()
|
||||
|
||||
let cmd = ["go", "run", "./main.go"]
|
||||
let cwd = new URL("../../tui/cmd/opencode", import.meta.url).pathname
|
||||
let cwd = url.fileURLToPath(new URL("../../tui/cmd/opencode", import.meta.url))
|
||||
if (Bun.embeddedFiles.length > 0) {
|
||||
const blob = Bun.embeddedFiles[0] as File
|
||||
const binary = path.join(Global.Path.cache, "tui", blob.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue