diff --git a/nsist/pyapp.nsi b/nsist/pyapp.nsi index c5fd0c0..bac2674 100644 --- a/nsist/pyapp.nsi +++ b/nsist/pyapp.nsi @@ -72,19 +72,15 @@ Section "!${PRODUCT_NAME}" sec_app ; Install shortcuts ; The output path becomes the working directory for shortcuts SetOutPath "%HOMEDRIVE%\%HOMEPATH%" - [% if single_shortcut %] - [% for scname, sc in ib.shortcuts.items() %] - CreateShortCut "$SMPROGRAMS\[[scname]].lnk" "[[sc['target'] ]]" \ - '[[ sc['parameters'] ]]' "$INSTDIR\[[ sc['icon'] ]]" - [% endfor %] - [% else %] - [# Multiple shortcuts: create a directory for them #] - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" - [% for scname, sc in ib.shortcuts.items() %] - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\[[scname]].lnk" "[[sc['target'] ]]" \ - '[[ sc['parameters'] ]]' "$INSTDIR\[[ sc['icon'] ]]" - [% endfor %] - [% endif %] + CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" + [% for scname, sc in ib.shortcuts.items() %] + SearchPath $0 "[[sc['target'] ]].exe" + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\[[scname]].lnk" $0 \ + '[[ sc['parameters'] ]]' "$INSTDIR\[[ sc['icon'] ]]" + [% endfor %] + ; Create shortcut to uninstaller + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" \ + "$INSTDIR\uninstall.exe" SetOutPath "$INSTDIR" [% endblock install_shortcuts %] @@ -108,8 +104,11 @@ Section "!${PRODUCT_NAME}" sec_app SectionEnd Section "Uninstall" + # Ask the user whether they really wish to uninstall - last chance to back out + MessageBox MB_OKCANCEL "Uninstall ${PRODUCT_NAME}. Are you sure?" IDOK Ok + Abort + Ok: SetShellVarContext all - Delete $INSTDIR\uninstall.exe Delete "$INSTDIR\${PRODUCT_ICON}" RMDir /r "$INSTDIR\pkgs" ; Uninstall files @@ -122,14 +121,10 @@ Section "Uninstall" [% endfor %] [% block uninstall_shortcuts %] ; Uninstall shortcuts - [% if single_shortcut %] - [% for scname in ib.shortcuts %] - Delete "$SMPROGRAMS\[[scname]].lnk" - [% endfor %] - [% else %] - RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}" - [% endif %] + RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}" + ; Uninstall the uninstaller [% endblock uninstall_shortcuts %] + Delete $INSTDIR\uninstall.exe RMDir $INSTDIR DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" SectionEnd