(allowCustomPath = false)
| 38 | } |
| 39 | |
| 40 | export 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 | |
| 56 | export function isPathWithinRoot(targetPath: string, rootPath: string): boolean { |
| 57 | const resolvedTarget = path.resolve(targetPath) |
no test coverage detected