installer: Clean up Windows Start Menu entry

* Clean up Windows Start Menu entry

* Clean up old Start Menu shortcuts when upgrading
This commit is contained in:
RedBlackAka 2025-03-21 19:00:00 +02:00 committed by GitHub
parent b225e856df
commit 9763488577
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -160,9 +160,10 @@ Section "Base"
!insertmacro UPDATE_DISPLAYNAME !insertmacro UPDATE_DISPLAYNAME
; Create start menu and desktop shortcuts ; Create start menu and desktop shortcuts
; This needs to be done after azahar.exe is copied Delete "$SMPROGRAMS\${PRODUCT_NAME}\$DisplayName.lnk"
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall $DisplayName.lnk"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\$DisplayName.lnk" "$INSTDIR\azahar.exe" RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortCut "$SMPROGRAMS\$DisplayName.lnk" "$INSTDIR\azahar.exe"
${If} $DesktopShortcut == 1 ${If} $DesktopShortcut == 1
CreateShortCut "$DESKTOP\$DisplayName.lnk" "$INSTDIR\azahar.exe" CreateShortCut "$DESKTOP\$DisplayName.lnk" "$INSTDIR\azahar.exe"
${EndIf} ${EndIf}
@ -171,11 +172,6 @@ Section "Base"
SetOutPath "$TEMP" SetOutPath "$TEMP"
SectionEnd SectionEnd
Section -AdditionalIcons
; Create start menu shortcut for the uninstaller
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall $DisplayName.lnk" "$INSTDIR\uninst.exe" "/$MultiUser.InstallMode"
SectionEnd
!include "FileFunc.nsh" !include "FileFunc.nsh"
Section -Post Section -Post
@ -200,10 +196,11 @@ SectionEnd
Section Uninstall Section Uninstall
!insertmacro UPDATE_DISPLAYNAME !insertmacro UPDATE_DISPLAYNAME
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall $DisplayName.lnk"
Delete "$DESKTOP\$DisplayName.lnk" Delete "$DESKTOP\$DisplayName.lnk"
Delete "$SMPROGRAMS\$DisplayName.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\$DisplayName.lnk" Delete "$SMPROGRAMS\${PRODUCT_NAME}\$DisplayName.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall $DisplayName.lnk"
RMDir "$SMPROGRAMS\${PRODUCT_NAME}" RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
; Be a bit careful to not delete files a user may have put into the install directory. ; Be a bit careful to not delete files a user may have put into the install directory.