; Blender Self-Installer for Windows (NSIS - http://nsis.sourceforge.net)
;
SetCompressor /SOLID lzma
Name "Blender [VERSION]"
RequestExecutionLevel admin
!include "MUI.nsh"
!include "WinVer.nsh"
!include "FileFunc.nsh"
!include "WordFunc.nsh"
!include "nsDialogs.nsh"
!include "x64.nsh"
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Blender. It is recommended that you close all other applications before starting Setup."
InstallDir $INSTDIR ; $INSTDIR is set inside .onInit
BrandingText "Blender Foundation | http://www.blender.org"
ComponentText "This will install Blender [VERSION] on your computer."
DirText "Use the field below to specify the folder where you want Blender to be copied to. To specify a different folder, type a new name or use the Browse button to select an existing folder."
SilentUnInstall normal
Var BLENDERHOME
Var SHORTVERSION ; This is blender_version_decimal() from path_util.c
; Custom controls
Var HWND
Var HWND_APPDATA
Var HWND_INSTDIR
Var HWND_HOMEDIR
Function .onInit
ClearErrors
StrCpy $SHORTVERSION "[SHORTVERSION]"
${If} ${RunningX64}
${If} "[BITNESS]" == "32"
${OrIf} "[BITNESS]" == "-mingw"
StrCpy $INSTDIR "$PROGRAMFILES32\Blender Foundation\Blender" ; Can't use InstallDir inside Section
${NSD_CreateLabel} 0 0 100% 24u "Please specify where you wish to install Blender's user data files. Be aware that if you choose to use your Application Data directory, your preferences and scripts will only be accessible by the current user account."
${NSD_CreateRadioButton} 0 50 100% 12u "Use Application Data directory (recommended)"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; refresh icons
SectionEnd
Section "Open .blend files with Blender" BlendRegister
ExecWait '"$INSTDIR\blender.exe" -r'
SectionEnd
UninstallText "This will uninstall Blender [VERSION], and all installed files. Before continuing make sure you have created backup of all the files you may want to keep: startup.blend, bookmarks.txt, recent-files.txt. Hit 'Uninstall' to continue."
MessageBox MB_YESNO "Recursively erase contents of $BLENDERHOME\$SHORTVERSION\scripts? NOTE: This includes all installed scripts and *any* file and directory you have manually created, installed later or copied. This also including .blend files." IDNO NextNoScriptRemove
RMDir /r "$BLENDERHOME\$SHORTVERSION\scripts"
NextNoScriptRemove:
MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\config? NOTE: This includes your startup.blend, bookmarks and any other file and directory you may have created in that directory" IDNO NextNoConfigRemove
RMDir /r "$BLENDERHOME\$SHORTVERSION\config"
NextNoConfigRemove:
MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\plugins? NOTE: This includes files and subdirectories in this directory" IDNO NextNoPluginRemove
RMDir /r "$BLENDERHOME\$SHORTVERSION\plugins"
NextNoPluginRemove:
; Try to remove dirs, but leave them if they contain anything