MCPcopy
hub / github.com/codeaashu/claude-code / toRelativePath

Function toRelativePath

src/utils/path.ts:95–99  ·  view source on GitHub ↗
(absolutePath: string)

Source from the content-addressed store, hash-verified

93 * @returns Relative path if under cwd, otherwise the original absolute path
94 */
95export function toRelativePath(absolutePath: string): string {
96 const relativePath = relative(getCwd(), absolutePath)
97 // If the relative path would go outside cwd (starts with ..), keep absolute
98 return relativePath.startsWith('..') ? absolutePath : relativePath
99}
100
101/**
102 * 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