From 3e8b891dd041f8d18d902a08717a529dbb87a929 Mon Sep 17 00:00:00 2001 From: MystiPanda Date: Sat, 8 Jun 2024 20:20:47 +0800 Subject: [PATCH] fix: run app as normal user --- src-tauri/template/installer.nsi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src-tauri/template/installer.nsi b/src-tauri/template/installer.nsi index cfd0090..11280aa 100644 --- a/src-tauri/template/installer.nsi +++ b/src-tauri/template/installer.nsi @@ -323,10 +323,15 @@ Var AppStartMenuFolder !define MUI_FINISHPAGE_SHOWREADME_TEXT "$(createDesktop)" !define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDesktopShortcut ; Show run app after installation. -!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAINBINARYNAME}.exe" +!define MUI_FINISHPAGE_RUN +!define MUI_FINISHPAGE_RUN_FUNCTION RunMainBinary !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfPassive !insertmacro MUI_PAGE_FINISH +Function RunMainBinary + nsis_tauri_utils::RunAsUser "$INSTDIR\${MAINBINARYNAME}.exe" "" +FunctionEnd + ; Uninstaller Pages ; 1. Confirm uninstall page Var DeleteAppDataCheckbox @@ -729,7 +734,7 @@ Function .onInstSuccess ${GetOptions} $CMDLINE "/R" $R0 IfErrors run_done 0 ${GetOptions} $CMDLINE "/ARGS" $R0 - Exec '"$INSTDIR\${MAINBINARYNAME}.exe" $R0' + nsis_tauri_utils::RunAsUser "$INSTDIR\${MAINBINARYNAME}.exe" "$R0" run_done: FunctionEnd