(wsJsonPath: string)
| 547 | * Returns null if the file cannot be read or the path cannot be derived |
| 548 | * (e.g. multi-root workspaces without a single folder). */ |
| 549 | export function parseWorkspaceFolderPath(wsJsonPath: string): string | null { |
| 550 | try { |
| 551 | const location = workspaceLocationFromJson(wsJsonPath); |
| 552 | if (!location) return null; |
| 553 | if (!location.startsWith('/') && !/^[A-Za-z]:/.test(location)) return null; |
| 554 | return location; |
| 555 | } catch (e) { |
| 556 | debugCore('parser-vscode', `Could not parse workspace folder path from ${wsJsonPath}`, e); |
| 557 | return null; |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | export function parseCLIWorkspaceName(wsYamlPath: string): string { |
| 562 | try { |
no test coverage detected