From 27ee4d69c8fa828d034a2d379ec8a608350dcafa Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Mon, 11 Nov 2024 21:14:30 +0800 Subject: [PATCH] windows: pack: fix nsis bmp-file not found and add installer script - #140 1. modify install.bmp to project-graph-install.bmp in tauri.config.json 2. add nsis installer script for config env-path 3. add installerHooks to ref installer.nsh Signed-off-by: Sunrisepeak --- src-tauri/nsis/installer.nsh | 7 +++++++ src-tauri/tauri.conf.json | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src-tauri/nsis/installer.nsh diff --git a/src-tauri/nsis/installer.nsh b/src-tauri/nsis/installer.nsh new file mode 100644 index 00000000..36f3fb88 --- /dev/null +++ b/src-tauri/nsis/installer.nsh @@ -0,0 +1,7 @@ +!macro NSIS_HOOK_POSTINSTALL + nsExec::ExecToLog 'powershell -Command "$p=[Environment]::GetEnvironmentVariable(\"PATH\",\"User\"); if($p -notlike \"*$INSTDIR*\") { setx PATH \"$p;$INSTDIR\" }"' +!macroend + +!macro NSIS_HOOK_POSTUNINSTALL + nsExec::ExecToLog 'powershell -Command "$p=[Environment]::GetEnvironmentVariable(\"PATH\",\"User\"); setx PATH ($p -replace [regex]::Escape(\"$INSTDIR\"),\"\")"' +!macroend \ No newline at end of file diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e3ab875a..72903b5b 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -43,7 +43,8 @@ "displayLanguageSelector": true, "languages": ["SimpChinese", "TradChinese", "English"], "sidebarImage": "nsis/left.bmp", - "headerImage": "nsis/install.bmp" + "headerImage": "nsis/project-graph-install.bmp", + "installerHooks": "nsis/installer.nsh" } } }