; qda.nsi !addincludedir $SMPROGRAMS\NSIS\Include ; Use the Modern UI !include "MUI.nsh" ; The name of the installer Name "Weft QDA" ; The file to write OutFile "weft-qda-install-${VERSION}.exe" ; The default installation directory InstallDir $PROGRAMFILES\WeftQDA2 ; Registry key to check for directory (so if you install again, it will ; overwrite the old one automatically) InstallDirRegKey HKLM "Software\NSIS_WeftQDA2" "Install_Dir" SetCompressor zlib VIProductVersion ${VERSIONEXTRA} VIAddVersionKey FileVersion ${VERSION} VIAddVersionKey FileDescription "Weft QDA installer" VIAddVersionKey LegalCopyright "Public Domain" VIAddVersionKey ProductName WeftQDA BrandingText "Weft QDA ${VERSION} Installer" ;Interface Settings !define MUI_ABORTWARNING !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico" !define MUI_HEADERIMAGE 1 !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp" !define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp" ; Pages !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ; The stuff to install Section "Weft QDA" SecCore SectionIn RO ; Set output path to the installation directory. SetOutPath $INSTDIR ; Put all the build files there File /r build\*.* ; And the standard ruby script File /r weft-qda.rb ; Write the installation path into the registry WriteRegStr HKLM SOFTWARE\NSIS_WeftQDA "Install_Dir" "$INSTDIR" ; back up old value of .qdp !define Index "Line${__LINE__}" ReadRegStr $1 HKCR ".qdp" "" StrCmp $1 "" "${Index}-NoBackup" StrCmp $1 "Weft Qualitative Data Project" "${Index}-NoBackup" WriteRegStr HKCR ".qdp" "backup_val" $1 "${Index}-NoBackup:" WriteRegStr HKCR ".qdp" "" "WeftQualitativeData" ReadRegStr $0 HKCR "WeftQualitativeData" "" StrCmp $0 "" 0 "${Index}-Skip" WriteRegStr HKCR "WeftQualitativeData" "" "Weft Qualitative Data Project" "${Index}-Skip:" WriteRegStr HKCR "WeftQualitativeData\shell" "" "open" WriteRegStr HKCR "WeftQualitativeData\DefaultIcon" "" "$INSTDIR\share\icons\project.ico" WriteRegStr HKCR "WeftQualitativeData\shell\open\command" "" '$INSTDIR\weft-qda.exe "%1"' !undef Index ; Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WeftQDA" "DisplayName" "NSIS WeftQDA" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WeftQDA" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WeftQDA" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WeftQDA" "NoRepair" 1 WriteUninstaller "uninstall.exe" SectionEnd LangString DESC_SecCore ${LANG_ENGLISH} "The core Weft QDA software (required)" ; Optional section (can be disabled by the user) Section "Start Menu Shortcuts" SecShortcuts CreateDirectory "$SMPROGRAMS\Weft QDA2" CreateShortCut "$SMPROGRAMS\Weft QDA2\Weft QDA.lnk" "$INSTDIR\weft-qda.bat" "" "$INSTDIR\weft-qda.exe" 0 ; CreateShortCut "$SMPROGRAMS\Weft QDA2\Weft QDA Help.lnk" "$INSTDIR\wefthelp.chm" "" "$INSTDIR\wefthelp.chm" 0 ; CreateShortCut "$SMPROGRAMS\Weft QDA2\Weft QDA PDF Manual.lnk" "$INSTDIR\wefthelp.pdf" "" "$INSTDIR\wefthelp.pdf" 0 CreateShortCut "$SMPROGRAMS\Weft QDA2\Weft QDA Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 SectionEnd LangString DESC_SecShortcuts ${LANG_ENGLISH} "Add shortcuts to Weft QDA to the Windows start menu (recommended)" Section "Help and Documentation" SecHelpfiles ; Set output path to the installation directory. SetOutPath $INSTDIR ;File "doc\wefthelp.chm" ;File "doc\wefthelp.pdf" SectionEnd LangString DESC_SecHelpfiles ${LANG_ENGLISH} "Install the Weft QDA help file and documentation (recommended)" !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(DESC_SecCore) !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(DESC_SecShortcuts) !insertmacro MUI_DESCRIPTION_TEXT ${SecHelpfiles} $(DESC_SecHelpfiles) !insertmacro MUI_FUNCTION_DESCRIPTION_END ; Uninstaller Section "Uninstall" ; Remove registry keys DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WeftQDA2" DeleteRegKey HKLM SOFTWARE\NSIS_WeftQDA2 ; Delete the installed files RMDir /r "$INSTDIR\share" RMDir /r "$INSTDIR\lib" RMDir /r "$INSTDIR\doc" Delete "$INSTDIR\*.dll" Delete "$INSTDIR\weft-qda*" Delete "$INSTDIR\uninstall.exe" RMDir $INSTDIR ; Remove shortcuts, if any Delete "$SMPROGRAMS\WeftQDA2\*.*" Delete "$SMPROGRAMS\Weft QDA2\*.*" ; Remove directories used RMDir "$SMPROGRAMS\WeftQDA2" RMDir "$SMPROGRAMS\Weft QDA2" ;start of restore script !define Index "Line${__LINE__}" ReadRegStr $1 HKCR ".qdp" "" StrCmp $1 "QualitativeData" 0 "${Index}-NoOwn" ; only do this if we own it ReadRegStr $1 HKCR ".qdp" "backup_val" StrCmp $1 "" 0 "${Index}-Restore" ; if backup="" then delete the whole key DeleteRegKey HKCR ".qdp" Goto "${Index}-NoOwn" "${Index}-Restore:" WriteRegStr HKCR ".qdp" "" $1 DeleteRegValue HKCR ".qdp" "backup_val" DeleteRegKey HKCR "QualitativeData" ;Delete key with association settings "${Index}-NoOwn:" !undef Index SectionEnd