MCPcopy Index your code
hub / github.com/anomalyco/opencode / windowsPath

Function windowsPath

packages/opencode/src/util/filesystem.ts:153–165  ·  view source on GitHub ↗
(p: string)

Source from the content-addressed store, hash-verified

151}
152
153export function windowsPath(p: string): string {
154 if (process.platform !== "win32") return p
155 return (
156 p
157 .replace(/^\/([a-zA-Z]):(?:[\\/]|$)/, (_, drive) => `${drive.toUpperCase()}:/`)
158 // Git Bash for Windows paths are typically /<drive>/...
159 .replace(/^\/([a-zA-Z])(?:\/|$)/, (_, drive) => `${drive.toUpperCase()}:/`)
160 // Cygwin git paths are typically /cygdrive/<drive>/...
161 .replace(/^\/cygdrive\/([a-zA-Z])(?:\/|$)/, (_, drive) => `${drive.toUpperCase()}:/`)
162 // WSL paths are typically /mnt/<drive>/...
163 .replace(/^\/mnt\/([a-zA-Z])(?:\/|$)/, (_, drive) => `${drive.toUpperCase()}:/`)
164 )
165}
166export function overlaps(a: string, b: string) {
167 return FSUtil.overlaps(a, b)
168}

Callers 2

normalizePathFunction · 0.70
resolveFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected