Skip to content

fix: split shell exec pattern for terminal file picker on Windows - #2637

Merged
love-linger merged 1 commit into
sourcegit-scm:developfrom
weiningwei:fix/shell-terminal-picker-pattern
Aug 20, 2026
Merged

fix: split shell exec pattern for terminal file picker on Windows#2637
love-linger merged 1 commit into
sourcegit-scm:developfrom
weiningwei:fix/shell-terminal-picker-pattern

Conversation

@weiningwei

Copy link
Copy Markdown
Contributor

On Windows, the shell/terminal file picker in Preferences could not display pwsh.exe / powershell.exe when the user tried to manually select the PowerShell executable.

Root cause

ShellOrTerminal.Exec for PowerShell is "pwsh.exe|powershell.exe", using | as a separator for alternative executable names. The file picker (SelectShellOrTerminal in src/Views/Preferences.axaml.cs) passed the entire string as a single glob pattern to FilePickerFileType.Patterns:

Patterns = [shell.Exec]

Avalonia's Win32 implementation joins the patterns with ; and hands the result to the native file dialog, which treats | as a literal character rather than an alternative separator. Since no file is literally named pwsh.exe|powershell.exe, the dialog showed nothing in the target directory.

The other Windows terminals (bash.exe, cmd.exe, wt.exe) use a single executable name and are unaffected.

Fix

Split Exec on | so each alternative becomes its own pattern entry. For PowerShell this produces ["pwsh.exe", "powershell.exe"], which the Win32 dialog matches as pwsh.exe;powershell.exe.

Patterns = shell.Exec.Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)

No behavior change for terminals with a single executable name.

Comment on lines +344 to +348
FileTypeFilter = [new FilePickerFileType(shell.Name)
{
Patterns = shell.Exec.Split('|',
StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
}],

@Mingun Mingun Aug 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would beter to change shell.Exec type from String (?) to String[] if that possible.

Signed-off-by: weiningwei <weiningwei09@gmail.com>
@weiningwei
weiningwei force-pushed the fix/shell-terminal-picker-pattern branch from 84a3f02 to bff6e20 Compare August 19, 2026 12:20
@love-linger love-linger self-assigned this Aug 20, 2026
@love-linger love-linger added the bug Something isn't working label Aug 20, 2026
@love-linger
love-linger merged commit 4fca32f into sourcegit-scm:develop Aug 20, 2026
14 checks passed
@weiningwei
weiningwei deleted the fix/shell-terminal-picker-pattern branch August 20, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

3 participants