MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getWorkspacePath

Function getWorkspacePath

src/utils/path.ts:152–168  ·  view source on GitHub ↗
(defaultCwdPath = "")

Source from the content-addressed store, hash-verified

150}
151
152export const getWorkspacePath = (defaultCwdPath = "") => {
153 const firstFolderPath =
154 vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) || defaultCwdPath
155
156 // Deterministic mode: always use the first workspace folder.
157 if (getRootResolutionStrategy() === "firstFolder") {
158 return firstFolderPath
159 }
160
161 // Default behavior: prefer the workspace folder containing the active editor.
162 const currentFileUri = vscode.window.activeTextEditor?.document.uri
163 if (currentFileUri) {
164 const workspaceFolder = vscode.workspace.getWorkspaceFolder(currentFileUri)
165 return workspaceFolder?.uri.fsPath || firstFolderPath
166 }
167 return firstFolderPath
168}
169
170export const getWorkspacePathForContext = (contextPath?: string): string => {
171 // In `firstFolder` mode the root is pinned to workspaceFolders[0],

Callers 15

path.spec.tsFile · 0.90
executeMethod · 0.90
constructorMethod · 0.90
getCheckpointServiceFunction · 0.90
webviewMessageHandlerFunction · 0.90
constructorMethod · 0.90
refreshWorkspaceMethod · 0.90
cwdMethod · 0.90
getWorkspaceRoomodesMethod · 0.90
watchCustomModesFilesMethod · 0.90
updateCustomModeMethod · 0.90
deleteRulesFolderMethod · 0.90

Calls 1

Tested by

no test coverage detected