Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSI Script Bugfix and Enhancements #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions nsist/pyapp.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -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 %]

Expand All @@ -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
Expand All @@ -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
Expand Down