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" } } }