(path_: typeof path.posix | typeof path.win32, workspaceOrFolderPath: string)
| 13 | } |
| 14 | |
| 15 | export function workspaceFromPath(path_: typeof path.posix | typeof path.win32, workspaceOrFolderPath: string): Workspace { |
| 16 | if (isWorkspacePath(workspaceOrFolderPath)) { |
| 17 | const workspaceFolder = path_.dirname(workspaceOrFolderPath); |
| 18 | return { |
| 19 | isWorkspaceFile: true, |
| 20 | workspaceOrFolderPath, |
| 21 | rootFolderPath: workspaceFolder, // use workspaceFolder as root folder |
| 22 | configFolderPath: workspaceFolder, // have config file in workspaceFolder (to be discussed...) |
| 23 | }; |
| 24 | } |
| 25 | return { |
| 26 | isWorkspaceFile: false, |
| 27 | workspaceOrFolderPath, |
| 28 | rootFolderPath: workspaceOrFolderPath, |
| 29 | configFolderPath: workspaceOrFolderPath, |
| 30 | }; |
| 31 | } |
| 32 | |
| 33 | export function isWorkspacePath(workspaceOrFolderPath: string) { |
| 34 | return path.extname(workspaceOrFolderPath) === '.code-workspace'; // TODO: Remove VS Code specific code. |
no test coverage detected