; Custom NSIS script for CutThenThink Lite ; This provides additional configuration for Windows installer !addincludedir "${CMAKE_CURRENT_SOURCE_DIR}/nsis" ; Modern UI Interface !include "MUI2.nsh" ; Installer Settings Name "CutThenThink Lite" OutFile "CutThenThink-Lite-Setup.exe" InstallDir "$PROGRAMFILES\CutThenThink Lite" InstallDirRegKey HKLM "Software\CutThenThink Lite" "InstallLocation" RequestExecutionLevel admin ; Variables Var StartMenuFolder ; Interface Settings !define MUI_ABORTWARNING !define MUI_ICON "icons\icon.ico" !define MUI_UNICON "icons\icon.ico" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "icons\header.bmp" ; Optional !define MUI_WELCOMEFINISHPAGE_BITMAP "icons\welcome.bmp" ; Optional ; Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "LICENSE" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ; Languages !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "SimpChinese" ; Installer Sections Section "Main Application" SecMain SectionIn RO SetOutPath $INSTDIR ; Install application files File /r "${CMAKE_CURRENT_SOURCE_DIR}\target\${RUST_TARGET}\release\bundle\nsis\*.*" ; Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" ; Register installation WriteRegStr HKLM "Software\CutThenThink Lite" "InstallLocation" "$INSTDIR" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CutThenThink Lite" "DisplayName" "CutThenThink Lite" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CutThenThink Lite" "UninstallString" "$INSTDIR\Uninstall.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CutThenThink Lite" "Publisher" "CutThenThink" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CutThenThink Lite" "DisplayVersion" "${TAURI_APP_VERSION}" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CutThenThink Lite" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CutThenThink Lite" "NoRepair" 1 ; Create Start Menu shortcuts !insertmacro MUI_STARTMENU_WRITE_BEGIN Application CreateDirectory "$SMPROGRAMS\$StartMenuFolder" CreateShortcut "$SMPROGRAMS\$StartMenuFolder\CutThenThink Lite.lnk" "$INSTDIR\CutThenThink Lite.exe" CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" !insertmacro MUI_STARTMENU_WRITE_END ; Create desktop shortcut CreateShortcut "$DESKTOP\CutThenThink Lite.lnk" "$INSTDIR\CutThenThink Lite.exe" SectionEnd ; Uninstaller Section Section "Uninstall" Delete "$INSTDIR\Uninstall.exe" Delete "$INSTDIR\*.*" RMDir /r "$INSTDIR" !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder Delete "$SMPROGRAMS\$StartMenuFolder\*.*" RMDir "$SMPROGRAMS\$StartMenuFolder" Delete "$DESKTOP\CutThenThink Lite.lnk" DeleteRegKey HKLM "Software\CutThenThink Lite" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CutThenThink Lite" SectionEnd