MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / toRelativePath

Function toRelativePath

source code/utils/path.ts:97–101  ·  view source on GitHub ↗
(absolutePath: string)

Source from the content-addressed store, hash-verified

95 * @returns Relative path if under cwd, otherwise the original absolute path
96 */
97export function toRelativePath(absolutePath: string): string {
98 const relativePath = relative(getCwd(), absolutePath)
99 // If the relative path would go outside cwd (starts with ..), keep absolute
100 return relativePath.startsWith('..') ? absolutePath : relativePath
101}
102
103/**
104 * Gets the directory path for a given file or directory path.

Callers 1

callFunction · 0.85

Calls 1

getCwdFunction · 0.85

Tested by

no test coverage detected