MCPcopy Create free account
hub / github.com/anomalyco/opencode / windowsPath

Function windowsPath

packages/core/src/fs-util.ts:239–246  ·  view source on GitHub ↗
(p: string)

Source from the content-addressed store, hash-verified

237 }
238
239 export function windowsPath(p: string): string {
240 if (process.platform !== "win32") return p
241 return p
242 .replace(/^\/([a-zA-Z]):(?:[\\/]|$)/, (_, drive) => `${drive.toUpperCase()}:/`)
243 .replace(/^\/([a-zA-Z])(?:\/|$)/, (_, drive) => `${drive.toUpperCase()}:/`)
244 .replace(/^\/cygdrive\/([a-zA-Z])(?:\/|$)/, (_, drive) => `${drive.toUpperCase()}:/`)
245 .replace(/^\/mnt\/([a-zA-Z])(?:\/|$)/, (_, drive) => `${drive.toUpperCase()}:/`)
246 }
247
248 export function overlaps(a: string, b: string) {
249 return contains(a, b) || contains(b, a)

Callers 2

normalizePathFunction · 0.70
resolveFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected