MCPcopy Create free account
hub / github.com/experdot/pointer / isPathWithinRoot

Function isPathWithinRoot

src/main/workspaceRuntime.ts:56–60  ·  view source on GitHub ↗
(targetPath: string, rootPath: string)

Source from the content-addressed store, hash-verified

54}
55
56export function isPathWithinRoot(targetPath: string, rootPath: string): boolean {
57 const resolvedTarget = path.resolve(targetPath)
58 const resolvedRoot = path.resolve(rootPath)
59 return resolvedTarget === resolvedRoot || resolvedTarget.startsWith(resolvedRoot + path.sep)
60}
61
62export function resolveRelativePathWithinRoot(rootPath: string, relativePath: string): string {
63 const normalizedRelativePath = path.normalize(relativePath)

Calls

no outgoing calls

Tested by

no test coverage detected