MCPcopy
hub / github.com/continuedev/continue / isUriWithinWorkspace

Function isUriWithinWorkspace

core/util/pathResolver.ts:19–29  ·  view source on GitHub ↗

* Checks if a URI is within any of the workspace directories * Also verifies the file actually exists, matching the behavior of resolveRelativePathInDir

(ide: IDE, uri: string)

Source from the content-addressed store, hash-verified

17 * Also verifies the file actually exists, matching the behavior of resolveRelativePathInDir
18 */
19async function isUriWithinWorkspace(ide: IDE, uri: string): Promise<boolean> {
20 const workspaceDirs = await ide.getWorkspaceDirs();
21 const { foundInDir } = findUriInDirs(uri, workspaceDirs);
22
23 // Check both: within workspace path AND file exists
24 if (foundInDir !== null) {
25 return await ide.fileExists(uri);
26 }
27
28 return false;
29}
30
31export async function resolveInputPath(
32 ide: IDE,

Callers 1

resolveInputPathFunction · 0.85

Calls 3

findUriInDirsFunction · 0.90
getWorkspaceDirsMethod · 0.65
fileExistsMethod · 0.65

Tested by

no test coverage detected