MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveLocalPath

Function resolveLocalPath

src/io.ts:161–170  ·  view source on GitHub ↗
(filePath: string, cwd: string, rootDir?: string)

Source from the content-addressed store, hash-verified

159}
160
161function resolveLocalPath(filePath: string, cwd: string, rootDir?: string): string {
162 const resolvedPath = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
163 if (rootDir && !isPathInside(resolvedPath, rootDir)) {
164 throw new AppError('INVALID_ARGS', 'Local path is outside the artifact adapter root', {
165 path: resolvedPath,
166 rootDir,
167 });
168 }
169 return resolvedPath;
170}
171
172function isPathInside(filePath: string, rootDir: string): boolean {
173 const relative = path.relative(rootDir, filePath);

Callers 1

Calls 1

isPathInsideFunction · 0.85

Tested by

no test coverage detected