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

Function normalizePathPattern

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

Source from the content-addressed store, hash-verified

123}
124
125export function normalizePathPattern(p: string): string {
126 if (process.platform !== "win32") return p
127 if (p === "*") return p
128 const match = p.match(/^(.*)[\\/]\*$/)
129 if (!match) return normalizePath(p)
130 const dir = /^[A-Za-z]:$/.test(match[1]) ? match[1] + "\\" : match[1]
131 return join(normalizePath(dir), "*")
132}
133
134// We cannot rely on path.resolve() here because git.exe may come from Git Bash, Cygwin, or MSYS2, so we need to translate these paths at the boundary.
135// Also resolves symlinks so that callers using the result as a cache key

Callers

nothing calls this directly

Calls 2

joinFunction · 0.85
normalizePathFunction · 0.70

Tested by

no test coverage detected