|
1 | 1 | import * as path from "path" |
2 | 2 | import * as os from "os" |
3 | 3 | import fs from "fs/promises" |
4 | | -import * as vscode from "vscode" |
5 | | - |
6 | | -/** |
7 | | - * Finds the workspace folder that contains a .roo directory |
8 | | - * |
9 | | - * @returns The workspace folder containing .roo, or undefined if not found |
10 | | - * |
11 | | - * @example |
12 | | - * ```typescript |
13 | | - * const workspaceWithRoo = findWorkspaceWithRoo() |
14 | | - * if (workspaceWithRoo) { |
15 | | - * // .roo folder exists as one of the workspace folders |
16 | | - * const rooPath = workspaceWithRoo.uri.fsPath |
17 | | - * } |
18 | | - * ``` |
19 | | - */ |
20 | | -export function findWorkspaceWithRoo(): vscode.WorkspaceFolder | undefined { |
21 | | - if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) { |
22 | | - return undefined |
23 | | - } |
24 | | - |
25 | | - // Check if any workspace folder is named .roo |
26 | | - for (const folder of vscode.workspace.workspaceFolders) { |
27 | | - if (path.basename(folder.uri.fsPath) === ".roo") { |
28 | | - return folder |
29 | | - } |
30 | | - } |
31 | | - |
32 | | - return undefined |
33 | | -} |
34 | 4 |
|
35 | 5 | /** |
36 | 6 | * Gets the global .roo directory path based on the current platform |
@@ -92,13 +62,10 @@ export function getGlobalRooDirectory(): string { |
92 | 62 | * subdirectory in the first workspace folder. |
93 | 63 | */ |
94 | 64 | export function getProjectRooDirectoryForCwd(cwd: string): string { |
95 | | - // Check if .roo is one of the workspace folders in a multi-root workspace |
96 | | - const workspaceWithRoo = findWorkspaceWithRoo() |
97 | | - if (workspaceWithRoo) { |
98 | | - return workspaceWithRoo.uri.fsPath |
99 | | - } |
100 | | - |
101 | | - // Default behavior: create .roo as a subdirectory |
| 65 | + // Note: In VS Code extension context, this function is overridden |
| 66 | + // by the extension to check for .roo workspace folders. |
| 67 | + // This base implementation is used by the webview and other contexts |
| 68 | + // where vscode API is not available. |
102 | 69 | return path.join(cwd, ".roo") |
103 | 70 | } |
104 | 71 |
|
|
0 commit comments