fix #1145 (Part 2)

This commit is contained in:
qhy040404
2023-12-03 22:02:48 +08:00
parent 21ad6be9da
commit 013639f57e
2 changed files with 7 additions and 1 deletions

View File

@@ -27,4 +27,10 @@ internal static class StringExtension
{
return source.AsSpan().TrimEnd(value).ToString();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool EqualsAny(this string source, string[] values, StringComparison comparisonType)
{
return values.Any(value => source.Equals(value, comparisonType));
}
}

View File

@@ -138,7 +138,7 @@ internal sealed partial class SettingViewModel : Abstraction.ViewModel
{
(bool isOk, ValueFile file) = fileSystemPickerInteraction.PickFile(SH.FilePickerPowerShellCommit, [("PowerShell", "powershell.exe;pwsh.exe")]);
if (isOk && Path.GetFileNameWithoutExtension(file).Equals("POWERSHELL", StringComparison.OrdinalIgnoreCase))
if (isOk && Path.GetFileNameWithoutExtension(file).EqualsAny(["POWERSHELL", "PWSH"], StringComparison.OrdinalIgnoreCase))
{
await taskContext.SwitchToMainThreadAsync();
Options.PowerShellPath = file;