MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / normalizePath

Function normalizePath

src/utils/path.ts:73–82  ·  view source on GitHub ↗
(p: string)

Source from the content-addressed store, hash-verified

71}
72
73function normalizePath(p: string): string {
74 // normalize resolve ./.. segments, removes duplicate slashes, and standardizes path separators
75 let normalized = path.normalize(p)
76 // however it doesn't remove trailing slashes
77 // remove trailing slash, except for root paths
78 if (normalized.length > 1 && (normalized.endsWith("/") || normalized.endsWith("\\"))) {
79 normalized = normalized.slice(0, -1)
80 }
81 return normalized
82}
83
84export function getReadablePath(cwd: string, relPath?: string): string {
85 // If relPath is undefined, return empty string instead of allowing path.resolve

Callers 1

arePathsEqualFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected