mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
7 lines
325 B
TypeScript
7 lines
325 B
TypeScript
import { encodeFilePath } from "@opencode/util/path"
|
|
import type { Files } from "@opencode/plugin/gui"
|
|
|
|
/** The file:// URL of a workspace-relative path. */
|
|
export function workspaceFileURL(files: Files, path: string) {
|
|
return `file://${encodeFilePath(`${files.root.replaceAll("\\", "/").replace(/\/+$/, "")}/${path}`)}`
|
|
}
|