MCPcopy Index your code
hub / github.com/coder/mux / isPathInsideDir

Function isPathInsideDir

src/node/utils/pathUtils.ts:140–146  ·  view source on GitHub ↗
(dirPath: string, filePath: string)

Source from the content-addressed store, hash-verified

138 * isPathInsideDir("/home/user/project", "/home/user/other/file.ts") // false
139 */
140export function isPathInsideDir(dirPath: string, filePath: string): boolean {
141 const resolvedDir = path.resolve(dirPath);
142 const resolvedFile = path.resolve(filePath);
143 const relative = path.relative(resolvedDir, resolvedFile);
144
145 return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
146}

Callers 8

writeArtifactMethod · 0.90
discoverSessionGroupsMethod · 0.90
resolvePatchPathFunction · 0.90
buildRuntimeTempPathFunction · 0.90
readTranscriptFromPathsFunction · 0.90

Calls 3

resolveMethod · 0.80
relativeMethod · 0.80
isAbsoluteMethod · 0.80

Tested by

no test coverage detected