diff --git a/src/main/fileOperations.ts b/src/main/fileOperations.ts index d7f4147..cc30b99 100644 --- a/src/main/fileOperations.ts +++ b/src/main/fileOperations.ts @@ -19,6 +19,10 @@ type FolderTree = { let currentWorkspaceRoot: string | null = null; let watcher: chokidar.FSWatcher | null = null; +export function getCurrentWorkspaceRoot(): string | null { + return currentWorkspaceRoot; +} + // Helper to (re)create watcher and wire up IPC notifications to renderer function ensureWatcher() { if (watcher) return watcher; diff --git a/src/main/pty.ts b/src/main/pty.ts index 62e6d5c..b761a8d 100644 --- a/src/main/pty.ts +++ b/src/main/pty.ts @@ -1,4 +1,5 @@ import * as pty from "node-pty"; +import { getCurrentWorkspaceRoot } from "./fileOperations"; export interface TerminalInstance { ptyProcess: pty.IPty; @@ -24,7 +25,7 @@ export class TerminalManager { name: "xterm-color", cols: 80, rows: 24, - cwd: process.cwd(), + cwd: getCurrentWorkspaceRoot() || process.cwd(), env: process.env, });