MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / getCwd

Function getCwd

vscode-extension/src/extension.ts:68–78  ·  view source on GitHub ↗

Determine the right working directory: workspace folder if available, else file's dir, else home.

()

Source from the content-addressed store, hash-verified

66
67/** Determine the right working directory: workspace folder if available, else file's dir, else home. */
68function getCwd(): string {
69 const folders = vscode.workspace.workspaceFolders;
70 if (folders && folders.length > 0) return folders[0].uri.fsPath;
71 const activeFile = vscode.window.activeTextEditor?.document?.uri?.fsPath;
72 if (activeFile) return path.dirname(activeFile);
73 // CRITICAL: fall back to home, NOT process.cwd().
74 // process.cwd() in the VS Code extension host is often '/' when VS Code was
75 // launched from Spotlight / dock / Applications folder — running QodeX from
76 // '/' breaks ~/.qodex resolution and is generally useless. Home is always sane.
77 return os.homedir();
78}
79
80/** Quote a shell string for bash / zsh. */
81function shellQuote(s: string): string {

Callers 7

openInTerminalFunction · 0.85
askAboutSelectionFunction · 0.85
editCurrentFileFunction · 0.85
runPlanFunction · 0.85
networkDiagFunction · 0.85
fixDiagnosticsFunction · 0.85
explainDiagnosticFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected