mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix #1145 (Part 2)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user