diff --git a/tabby-local/src/api.ts b/tabby-local/src/api.ts index e5c047aa..6d838869 100644 --- a/tabby-local/src/api.ts +++ b/tabby-local/src/api.ts @@ -13,6 +13,8 @@ export interface Shell { */ fsBase?: string + cwd?: string + /** * SVG icon */ diff --git a/tabby-local/src/profiles.ts b/tabby-local/src/profiles.ts index de8625b0..81ee9746 100644 --- a/tabby-local/src/profiles.ts +++ b/tabby-local/src/profiles.ts @@ -80,6 +80,7 @@ export class LocalProfilesService extends ProfileProvider { command: shell.command, args: shell.args ?? [], env: shell.env, + cwd: shell.cwd, } } diff --git a/tabby-local/src/shells/msys2.ts b/tabby-local/src/shells/msys2.ts index 3cee0ac9..c205babf 100644 --- a/tabby-local/src/shells/msys2.ts +++ b/tabby-local/src/shells/msys2.ts @@ -26,6 +26,13 @@ export class MSYS2ShellProvider extends ShellProvider { return [] } + let homePath: string|undefined = path.resolve(msys2Path, 'home', process.env.USERNAME!) + try { + await fs.access(msys2Path) + } catch { + homePath = undefined + } + const environments = ['msys', 'mingw64', 'clang64', 'ucrt64'] return environments.map(e => ({ @@ -35,6 +42,7 @@ export class MSYS2ShellProvider extends ShellProvider { args: ['-defterm', '-here', '-no-start', '-' + e], icon: require('../icons/msys2.svg'), env: {}, + cwd: homePath, })) } }