Page MenuHome

nsis.patch

Authored By
Caleb (dobz116)
Nov 13 2013, 3:10 PM
Size
8 KB
Subscribers
None

nsis.patch

Index: 00.sconsblender.nsi
===================================================================
--- 00.sconsblender.nsi (revision 35837)
+++ 00.sconsblender.nsi (working copy)
@@ -6,19 +6,20 @@
; Requires the MoreInfo plugin - http://nsis.sourceforge.net/MoreInfo_plug-in
;
+SetCompressor /SOLID lzma
+
+Name "Blender [VERSION]"
+
+!define MULTIUSER_EXECUTIONLEVEL Admin
+
!include "MUI.nsh"
!include "WinVer.nsh"
!include "FileFunc.nsh"
!include "WordFunc.nsh"
!include "nsDialogs.nsh"
+!include "MultiUser.nsh"
!include "x64.nsh"
-RequestExecutionLevel user
-
-SetCompressor /SOLID lzma
-
-Name "Blender [VERSION]"
-
!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."
@@ -60,21 +61,17 @@
;Language Strings
;Description
- LangString DESC_SecCopyUI ${LANG_ENGLISH} "Copy all required files to the application folder."
- LangString DESC_Section2 ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
- LangString DESC_Section3 ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
- LangString DESC_Section4 ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
+ LangString DESC_InstallFiles ${LANG_ENGLISH} "Copy all required files to the application folder."
+ LangString DESC_StartMenu ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
+ LangString DESC_DesktopShortcut ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
+ LangString DESC_BlendRegister ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Specify User Data Location"
;--------------------------------
;Data
Caption "Blender [VERSION] Installer"
OutFile "[DISTDIR]\..\blender-[VERSION]-windows[BITNESS].exe"
-;InstallDir "$PROGRAMFILES[BITNESS]\Blender Foundation\Blender"
-; Install to user profile dir. While it is non-standard, it allows
-; users to install without having to have the installer run in elevated mode.
-InstallDir "$PROFILE\Blender Foundation\Blender"
-
+InstallDir $INSTDIR ; $INSTDIR is set inside .onInit
BrandingText "Blender Foundation | http://www.blender.org"
ComponentText "This will install Blender [VERSION] on your computer."
@@ -94,9 +91,25 @@
Function .onInit
ClearErrors
+ !insertmacro MULTIUSER_INIT ; Checks if user has admin rights
StrCpy $SHORTVERSION "[SHORTVERSION]"
+
+ ${If} ${RunningX64}
+ ${If} "[BITNESS]" == "32"
+ ${OrIf} "[BITNESS]" == "-mingw"
+ StrCpy $INSTDIR "$PROGRAMFILES32\Blender Foundation\Blender" ; can't use InstallDir inside Section
+ ${ElseIf} "[BITNESS]" == "64"
+ StrCpy $INSTDIR "$PROGRAMFILES64\Blender Foundation\Blender"
+ ${EndIf}
+ ${Else}
+ StrCpy $INSTDIR "$PROGRAMFILES\Blender Foundation\Blender"
+ ${EndIf}
FunctionEnd
+Function un.onInit
+ !insertmacro MULTIUSER_UNINIT
+FunctionEnd
+
Function DataLocation
nsDialogs::Create /NOUNLOAD 1018
Pop $HWND
@@ -142,7 +155,7 @@
${EndIf}
FunctionEnd
-Section "Blender-[VERSION] (required)" SecCopyUI
+Section "Blender [VERSION] (required)" InstallFiles
SectionIn RO
; Set output path to the installation directory.
@@ -155,20 +168,27 @@
SetOutPath $INSTDIR
${If} ${RunningX64}
- SetRegView 64
+ ${AndIf} "[BITNESS]" == "64"
+ SetRegView 64
${EndIf}
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir" "$BLENDERHOME"
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ShortVersion" "[SHORTVERSION]"
; Write the uninstall keys for Windows
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender (remove only)"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"'
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "Publisher" "Blender Foundation"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "URLInfoAbout" "http://www.blender.org/"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayVersion" "[VERSION]"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayIcon" "$INSTDIR\blender.exe"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"'
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoModify" 1
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "NoRepair " 1
WriteUninstaller "uninstall.exe"
SectionEnd
-Section "Add Start Menu shortcuts" Section2
+Section "Add Start Menu Shortcuts" StartMenu
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\Blender Foundation\Blender\"
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
@@ -178,14 +198,15 @@
CreateShortCut "$SMPROGRAMS\Blender Foundation\Blender\GPL-license.lnk" "$INSTDIR\GPL-license.txt" "" "$INSTDIR\GPL-license.txt" 0
SectionEnd
-Section "Add Desktop Blender-[VERSION] shortcut" Section3
+Section "Add Desktop Shortcut" DesktopShortcut
CreateShortCut "$DESKTOP\Blender.lnk" "$INSTDIR\blender.exe" "" "$INSTDIR\blender.exe" 0
SectionEnd
-Section "Open .blend files with Blender-[VERSION]" Section4
+Section "Open .blend files with Blender" BlendRegister
${If} ${RunningX64}
- SetRegView 64
+ ${AndIf} "[BITNESS]" == "64"
+ SetRegView 64
${EndIf}
WriteRegStr HKCR ".blend" "" "blendfile"
WriteRegStr HKCR "blendfile" "" "Blender .blend File"
@@ -196,12 +217,13 @@
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 next to continue."
+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."
Section "Uninstall"
; remove registry keys
${If} ${RunningX64}
- SetRegView 64
+ ${AndIf} "[BITNESS]" == "64"
+ SetRegView 64
${EndIf}
ReadRegStr $BLENDERHOME HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir"
ReadRegStr $SHORTVERSION HKLM "SOFTWARE\BlenderFoundation" "ShortVersion"
@@ -212,9 +234,6 @@
; remove files
[DELROOTDIRCONTS]
- ; remove bundled python
- RmDir /r $INSTDIR\$SHORTVERSION\python
-
Delete "$INSTDIR\uninstall.exe"
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
@@ -236,16 +255,15 @@
Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*"
Delete "$DESKTOP\Blender.lnk"
; remove all link related directories and files
- RMDir "$SMPROGRAMS\Blender Foundation\Blender"
- RMDir "$SMPROGRAMS\Blender Foundation"
+ RMDir /r "$SMPROGRAMS\Blender Foundation"
; Clear out installation dir
- RMDir "$INSTDIR"
+ RMDir /r "$INSTDIR"
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
- !insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)
- !insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
- !insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
- !insertmacro MUI_DESCRIPTION_TEXT ${Section4} $(DESC_Section4)
+ !insertmacro MUI_DESCRIPTION_TEXT ${InstallFiles} $(DESC_InstallFiles)
+ !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} $(DESC_StartMenu)
+ !insertmacro MUI_DESCRIPTION_TEXT ${DesktopShortcut} $(DESC_DesktopShortcut)
+ !insertmacro MUI_DESCRIPTION_TEXT ${BlendRegister} $(DESC_BlendRegister)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
1f/c8/d1bc6049453ae3980a13c76c499e

Event Timeline