diff --git a/src/components/paneEditor.component.pug b/src/components/paneEditor.component.pug index 13896fe..e102c99 100644 --- a/src/components/paneEditor.component.pug +++ b/src/components/paneEditor.component.pug @@ -18,7 +18,7 @@ input.form-control( type='text', [(ngModel)]='pane.cwd', - placeholder='C:\\path\\to\\project' + placeholder='C:\\path\\to\\project or /home/user/project' ) .form-group diff --git a/src/services/workspaceEditor.service.ts b/src/services/workspaceEditor.service.ts index f108650..0a4a4af 100644 --- a/src/services/workspaceEditor.service.ts +++ b/src/services/workspaceEditor.service.ts @@ -212,12 +212,18 @@ export class WorkspaceEditorService { } } + const rawCwd = pane.cwd || baseProfile.options?.cwd || '' + const isWsl = this.isWslProfile(baseProfile) + const baseArgs = baseProfile.options?.args || [] + // Build complete profile object like Tabby expects const options = { restoreFromPTYID: false, command: baseProfile.options?.command || '', - args: baseProfile.options?.args || [], - cwd: pane.cwd || baseProfile.options?.cwd || '', + // WSL: inject --cd to set Linux CWD directly (bypasses fs.existsSync validation) + args: isWsl && rawCwd ? [...baseArgs, '--cd', rawCwd] : baseArgs, + // WSL: don't set cwd (Unix paths fail fs.existsSync on Windows) + cwd: isWsl ? '' : rawCwd, env: baseProfile.options?.env || {}, width: null, height: null, @@ -247,7 +253,6 @@ export class WorkspaceEditorService { // tabTitle: workspace name (what user sees) // tabCustomTitle: pane.id (for matching in StartupCommandService) // workspaceId: for duplicate detection after Tabby recovery - const cwd = pane.cwd || baseProfile.options?.cwd || '' return { type: 'app:local-tab', profile, @@ -256,7 +261,7 @@ export class WorkspaceEditorService { tabCustomTitle: pane.id, workspaceId, disableDynamicTitle: true, - cwd, + cwd: isWsl ? '' : rawCwd, } } @@ -289,6 +294,11 @@ export class WorkspaceEditorService { || 'workspace' } + /** Detects WSL profiles by ID prefix (type is always 'local' for all built-in shells). */ + private isWslProfile(profile: TabbyProfile): boolean { + return profile.id?.startsWith('local:wsl') ?? false + } + private getProfileById(profileId: string): TabbyProfile | undefined { const isLocalType = (type: string) => type === 'local' || type?.startsWith('local:')