From 8f3e166773f0d963bb83162006895cfb11716765 Mon Sep 17 00:00:00 2001 From: qhy040404 Date: Sun, 3 Dec 2023 22:26:55 +0800 Subject: [PATCH] fix #1151 --- src/Snap.Hutao/Snap.Hutao/Core/Shell/ShellLinkInterop.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Snap.Hutao/Snap.Hutao/Core/Shell/ShellLinkInterop.cs b/src/Snap.Hutao/Snap.Hutao/Core/Shell/ShellLinkInterop.cs index 1172d6d7..dec8fbeb 100644 --- a/src/Snap.Hutao/Snap.Hutao/Core/Shell/ShellLinkInterop.cs +++ b/src/Snap.Hutao/Snap.Hutao/Core/Shell/ShellLinkInterop.cs @@ -1,6 +1,7 @@ // Copyright (c) DGP Studio. All rights reserved. // Licensed under the MIT license. +using Snap.Hutao.Service; using System.IO; using System.Runtime.InteropServices; using Windows.Storage; @@ -18,6 +19,7 @@ namespace Snap.Hutao.Core.Shell; internal sealed partial class ShellLinkInterop : IShellLinkInterop { private readonly RuntimeOptions runtimeOptions; + private readonly AppOptions appOptions; public async ValueTask TryCreateDesktopShoutcutForElevatedLaunchAsync() { @@ -43,7 +45,7 @@ internal sealed partial class ShellLinkInterop : IShellLinkInterop HRESULT result = CoCreateInstance(null, CLSCTX.CLSCTX_INPROC_SERVER, out IShellLinkW shellLink); Marshal.ThrowExceptionForHR(result); - shellLink.SetPath("powershell"); + shellLink.SetPath(appOptions.PowerShellPath); shellLink.SetArguments($""" -Command "Start-Process shell:AppsFolder\{runtimeOptions.FamilyName}!App -verb runas" """);