leocad/tools/setup/leocad.nsi

149 lines
4.6 KiB
Text
Raw Normal View History

2020-09-05 19:29:53 +02:00
!include "MUI2.nsh"
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
; The name of the installer
Name "LeoCAD"
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
; The file to write
2020-09-05 19:40:18 +02:00
;OutFile "leocad-setup.exe"
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
; Request application privileges for Windows Vista
;RequestExecutionLevel admin
; Build Unicode installer
Unicode True
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
; The default installation directory
InstallDir $PROGRAMFILES64\LeoCAD
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\LeoCAD Software\LeoCAD" "InstallFolder"
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
; Icon "setup.ico"
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
; !define MUI_ICON "setup.ico"
; !define MUI_UNICON "setup.ico"
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
SetCompressor /SOLID lzma
2011-09-07 23:06:51 +02:00
2011-09-07 23:06:51 +02:00
;Interface Settings
2020-09-05 19:29:53 +02:00
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING
2011-09-07 23:06:51 +02:00
;Pages
2020-09-05 19:29:53 +02:00
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
2020-09-05 19:29:53 +02:00
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\LeoCAD.exe"
!insertmacro MUI_PAGE_FINISH
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
2011-09-07 23:06:51 +02:00
2020-09-05 19:29:53 +02:00
!insertmacro MUI_LANGUAGE "English"
2011-09-07 23:06:51 +02:00
;Installer Sections
Section "Application Files" SecLeoCAD
2011-09-07 23:06:51 +02:00
SectionIn RO
2011-09-07 23:06:51 +02:00
SetOutPath "$INSTDIR"
File /r /x library.bin "appdir\*.*"
2012-04-11 06:58:40 +02:00
2012-04-06 01:50:09 +02:00
;Register file extension
WriteRegStr HKCR ".lcd" "" "LeoCAD.Project"
WriteRegStr HKCR ".lcd\ShellNew" "NullFile" ""
WriteRegStr HKCR "LeoCAD.Project" "" "LeoCAD Project"
WriteRegStr HKCR "LeoCAD.Project\DefaultIcon" "" "$INSTDIR\LeoCAD.exe,0"
WriteRegStr HKCR "LeoCAD.Project\shell" "" "open"
WriteRegStr HKCR "LeoCAD.Project\shell\open\command" "" '"$INSTDIR\LeoCAD.exe" "%1"'
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
2019-06-17 08:07:40 +02:00
IfFileExists "$INSTDIR\vc_redist.x64.exe" VcRedist64Exists PastVcRedist64Check
VcRedist64Exists:
ExecWait '"$INSTDIR\vc_redist.x64.exe" /quiet /norestart'
PastVcRedist64Check:
2011-09-07 23:06:51 +02:00
;Store installation folder
2020-09-05 19:29:53 +02:00
;WriteRegStr HKLM "Software\LeoCAD Software\LeoCAD" "InstallFolder" $INSTDIR
2011-09-07 23:06:51 +02:00
CreateShortCut "$SMPROGRAMS\LeoCAD.lnk" "$INSTDIR\LeoCAD.exe"
;Create uninstaller
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "DisplayName" "LeoCAD"
2021-11-20 21:07:16 +01:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "DisplayVersion" $%VERSION%
2020-09-05 19:29:53 +02:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "Publisher" "LeoCAD.org"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "DisplayIcon" '"$INSTDIR\LeoCAD.exe"'
2011-09-07 23:06:51 +02:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "URLUpdateInfo" "https://www.leocad.org"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "URLInfoAbout" "https://www.leocad.org"
2011-09-07 23:06:51 +02:00
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "NoRepair" 1
2020-09-05 19:29:53 +02:00
!include "FileFunc.nsh"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD" "EstimatedSize" "$0"
2011-09-07 23:06:51 +02:00
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Parts Library" SecLibrary
SetOutPath "$INSTDIR"
File "appdir\library.bin"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecLeoCAD ${LANG_ENGLISH} "Application Files (required)"
LangString DESC_SecLibrary ${LANG_ENGLISH} "Library of parts that represent those produced by the LEGO company and created by the LDraw community"
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecLeoCAD} $(DESC_SecLeoCAD)
!insertmacro MUI_DESCRIPTION_TEXT ${SecLibrary} $(DESC_SecLibrary)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
2011-09-07 23:06:51 +02:00
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$SMPROGRAMS\LeoCAD.lnk"
Delete "$INSTDIR\Uninstall.exe"
Delete "$INSTDIR\LeoCAD.exe"
Delete "$INSTDIR\LeoCAD.hlp"
Delete "$INSTDIR\LeoCAD.cnt"
2021-03-22 02:02:03 +01:00
Delete "$INSTDIR\readme.txt"
Delete "$INSTDIR\library.bin"
2018-01-16 03:07:48 +01:00
Delete "$INSTDIR\povconsole32-sse2.exe"
2019-06-17 08:07:40 +02:00
Delete "$INSTDIR\vc_redist.x64.exe"
2011-09-07 23:06:51 +02:00
RMDir "$INSTDIR"
2012-04-06 01:50:09 +02:00
DeleteRegKey HKCR ".lcd"
DeleteRegKey HKCR "LeoCAD.Project"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
2011-09-07 23:06:51 +02:00
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LeoCAD"
2020-09-05 19:29:53 +02:00
DeleteRegKey HKLM "Software\LeoCAD Software\LeoCAD\InstallFolder"
DeleteRegKey /ifempty HKCU "Software\LeoCAD Software\LeoCAD"
2011-09-07 23:06:51 +02:00
SectionEnd