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

Function getAllowedFileSystemRoots

src/main/workspaceRuntime.ts:40–54  ·  view source on GitHub ↗
(allowCustomPath = false)

Source from the content-addressed store, hash-verified

38}
39
40export function getAllowedFileSystemRoots(allowCustomPath = false): string[] {
41 const roots = new Set<string>([normalizeRoot(app.getPath('userData'))])
42
43 if (allowCustomPath) {
44 for (const workspaceRoot of approvedWorkspaceRoots) {
45 roots.add(workspaceRoot)
46 }
47 }
48
49 if (currentWorkspaceRoot) {
50 roots.add(currentWorkspaceRoot)
51 }
52
53 return Array.from(roots)
54}
55
56export function isPathWithinRoot(targetPath: string, rootPath: string): boolean {
57 const resolvedTarget = path.resolve(targetPath)

Callers 1

validatePathFunction · 0.90

Calls 1

normalizeRootFunction · 0.85

Tested by

no test coverage detected