Bug fix for 8634, 6708, and 5989
This replaces the hard-coded '%PROFILE%\Application Data\..." path with the correct language-dependant CSIDL_APPDATA. PLEASE NOTE! Checks for the previous location have now been REMOVED. Any data saved in the old hard-coded location will no longer be found by Blender (this will only affect users of non-english windows.) The installer has been updated to help the user to migrate their data to the new location of their choice, if necessary. Order of preference for .blender on windows is now the following: 1) %HOME% environment var 2) Installation Directory (location of blender.exe) 3) "Current User" (CSIDL_APPDATA) 4) "All Users" (CSIDL_COMMON_APPDATA)
This commit is contained in:
@@ -7,8 +7,10 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
!include "MUI.nsh"
|
!include "MUI.nsh"
|
||||||
|
!include "WinVer.nsh"
|
||||||
!include "FileFunc.nsh"
|
!include "FileFunc.nsh"
|
||||||
!include "WordFunc.nsh"
|
!include "WordFunc.nsh"
|
||||||
|
!include "nsDialogs.nsh"
|
||||||
|
|
||||||
SetCompressor /SOLID lzma
|
SetCompressor /SOLID lzma
|
||||||
|
|
||||||
@@ -29,7 +31,9 @@ Name "Blender VERSION"
|
|||||||
!insertmacro MUI_PAGE_COMPONENTS
|
!insertmacro MUI_PAGE_COMPONENTS
|
||||||
|
|
||||||
!insertmacro MUI_PAGE_DIRECTORY
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
Page custom DataLocation
|
Page custom DataLocation DataLocationOnLeave
|
||||||
|
Page custom AppDataChoice AppDataChoiceOnLeave
|
||||||
|
Page custom PreMigrateUserSettings MigrateUserSettings
|
||||||
!insertmacro MUI_PAGE_INSTFILES
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
!insertmacro MUI_PAGE_FINISH
|
!insertmacro MUI_PAGE_FINISH
|
||||||
|
|
||||||
@@ -66,101 +70,13 @@ Caption "Blender VERSION Installer"
|
|||||||
OutFile "DISTDIR\..\blender-VERSION-windows.exe"
|
OutFile "DISTDIR\..\blender-VERSION-windows.exe"
|
||||||
InstallDir "$PROGRAMFILES\Blender Foundation\Blender"
|
InstallDir "$PROGRAMFILES\Blender Foundation\Blender"
|
||||||
|
|
||||||
BrandingText "http://www.blender.org/bf"
|
BrandingText "http://www.blender.org"
|
||||||
ComponentText "This will install Blender VERSION on your computer."
|
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."
|
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
|
SilentUnInstall normal
|
||||||
|
|
||||||
; GetWindowsVersion
|
|
||||||
;
|
|
||||||
; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
|
|
||||||
; Updated by Joost Verburg
|
|
||||||
;
|
|
||||||
; Returns on top of stack
|
|
||||||
;
|
|
||||||
; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
|
|
||||||
; or
|
|
||||||
; '' (Unknown Windows Version)
|
|
||||||
;
|
|
||||||
; Usage:
|
|
||||||
; Call GetWindowsVersion
|
|
||||||
; Pop $R0
|
|
||||||
; ; at this point $R0 is "NT 4.0" or whatnot
|
|
||||||
|
|
||||||
Function GetWindowsVersion
|
|
||||||
|
|
||||||
Push $R0
|
|
||||||
Push $R1
|
|
||||||
|
|
||||||
ReadRegStr $R0 HKLM \
|
|
||||||
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
|
|
||||||
|
|
||||||
IfErrors 0 lbl_winnt
|
|
||||||
|
|
||||||
; we are not NT
|
|
||||||
ReadRegStr $R0 HKLM \
|
|
||||||
"SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
|
|
||||||
|
|
||||||
StrCpy $R1 $R0 1
|
|
||||||
StrCmp $R1 '4' 0 lbl_error
|
|
||||||
|
|
||||||
StrCpy $R1 $R0 3
|
|
||||||
|
|
||||||
StrCmp $R1 '4.0' lbl_win32_95
|
|
||||||
StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
|
|
||||||
|
|
||||||
lbl_win32_95:
|
|
||||||
StrCpy $R0 '95'
|
|
||||||
Goto lbl_done
|
|
||||||
|
|
||||||
lbl_win32_98:
|
|
||||||
StrCpy $R0 '98'
|
|
||||||
Goto lbl_done
|
|
||||||
|
|
||||||
lbl_win32_ME:
|
|
||||||
StrCpy $R0 'ME'
|
|
||||||
Goto lbl_done
|
|
||||||
|
|
||||||
lbl_winnt:
|
|
||||||
|
|
||||||
StrCpy $R1 $R0 1
|
|
||||||
|
|
||||||
StrCmp $R1 '3' lbl_winnt_x
|
|
||||||
StrCmp $R1 '4' lbl_winnt_x
|
|
||||||
|
|
||||||
StrCpy $R1 $R0 3
|
|
||||||
|
|
||||||
StrCmp $R1 '5.0' lbl_winnt_2000
|
|
||||||
StrCmp $R1 '5.1' lbl_winnt_XP
|
|
||||||
StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
|
|
||||||
|
|
||||||
lbl_winnt_x:
|
|
||||||
StrCpy $R0 "NT $R0" 6
|
|
||||||
Goto lbl_done
|
|
||||||
|
|
||||||
lbl_winnt_2000:
|
|
||||||
Strcpy $R0 '2000'
|
|
||||||
Goto lbl_done
|
|
||||||
|
|
||||||
lbl_winnt_XP:
|
|
||||||
Strcpy $R0 'XP'
|
|
||||||
Goto lbl_done
|
|
||||||
|
|
||||||
lbl_winnt_2003:
|
|
||||||
Strcpy $R0 '2003'
|
|
||||||
Goto lbl_done
|
|
||||||
|
|
||||||
lbl_error:
|
|
||||||
Strcpy $R0 ''
|
|
||||||
lbl_done:
|
|
||||||
|
|
||||||
Pop $R1
|
|
||||||
Exch $R0
|
|
||||||
|
|
||||||
FunctionEnd
|
|
||||||
|
|
||||||
# Uses $0
|
# Uses $0
|
||||||
Function openLinkNewWindow
|
Function openLinkNewWindow
|
||||||
Push $3
|
Push $3
|
||||||
@@ -196,22 +112,74 @@ Function openLinkNewWindow
|
|||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Var BLENDERHOME
|
Var BLENDERHOME
|
||||||
Var winversion
|
|
||||||
Var DLL_found
|
Var DLL_found
|
||||||
|
Var PREVHOME
|
||||||
|
|
||||||
Function SetWinXPPath
|
Function SetWinXPPathCurrentUser
|
||||||
StrCpy $BLENDERHOME "$PROFILE\Application Data\Blender Foundation\Blender"
|
SetShellVarContext current
|
||||||
|
StrCpy $BLENDERHOME "$APPDATA\Blender Foundation\Blender"
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function SetWinXPPathAllUsers
|
||||||
|
SetShellVarContext all
|
||||||
|
StrCpy $BLENDERHOME "$APPDATA\Blender Foundation\Blender"
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function SetWin9xPath
|
Function SetWin9xPath
|
||||||
StrCpy $BLENDERHOME $INSTDIR
|
StrCpy $BLENDERHOME $INSTDIR
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function .onInit
|
; custom controls
|
||||||
Call GetWindowsVersion
|
Var HWND
|
||||||
Pop $R0
|
|
||||||
Strcpy $winversion $R0
|
Var HWND_APPDATA
|
||||||
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "RELDIR\data.ini" "data.ini"
|
Var HWND_INSTDIR
|
||||||
|
Var HWND_HOMEDIR
|
||||||
|
|
||||||
|
Var HWND_BUTTON_YES
|
||||||
|
Var HWND_BUTTON_NO
|
||||||
|
|
||||||
|
Var SETUSERCONTEXT
|
||||||
|
|
||||||
|
Function PreMigrateUserSettings
|
||||||
|
StrCpy $PREVHOME "$PROFILE\Application Data\Blender Foundation\Blender"
|
||||||
|
StrCpy $0 "$PROFILE\Application Data\Blender Foundation\Blender\.blender"
|
||||||
|
|
||||||
|
IfFileExists $0 0 nochange
|
||||||
|
|
||||||
|
StrCmp $BLENDERHOME $PREVHOME nochange
|
||||||
|
|
||||||
|
nsDialogs::Create /NOUNLOAD 1018
|
||||||
|
Pop $HWND
|
||||||
|
|
||||||
|
${If} $HWND == error
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
${NSD_CreateLabel} 0 0 100% 12u "You have existing settings at:"
|
||||||
|
${NSD_CreateLabel} 0 20 100% 12u $PREVHOME
|
||||||
|
${NSD_CreateLabel} 0 40 100% 12u "Do you wish to migrate this data to:"
|
||||||
|
${NSD_CreateLabel} 0 60 100% 12u $BLENDERHOME
|
||||||
|
${NSD_CreateLabel} 0 80 100% 12u "Please note: If you choose no, Blender will not be able to use these files!"
|
||||||
|
${NSD_CreateRadioButton} 0 100 100% 12u "Yes"
|
||||||
|
Pop $HWND_BUTTON_YES
|
||||||
|
${NSD_CreateRadioButton} 0 120 100% 12u "No"
|
||||||
|
Pop $HWND_BUTTON_NO
|
||||||
|
|
||||||
|
SendMessage $HWND_BUTTON_YES ${BM_SETCHECK} 1 0
|
||||||
|
|
||||||
|
nsDialogs::Show
|
||||||
|
nochange:
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function MigrateUserSettings
|
||||||
|
${NSD_GetState} $HWND_BUTTON_YES $R0
|
||||||
|
${If} $R0 == "1"
|
||||||
|
CreateDirectory $BLENDERHOME
|
||||||
|
CopyFiles $PREVHOME\*.* $BLENDERHOME
|
||||||
|
;RMDir /r $PREVHOME
|
||||||
|
${EndIf}
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
!define DLL_VER "8.00.50727.42"
|
!define DLL_VER "8.00.50727.42"
|
||||||
@@ -271,71 +239,91 @@ Function PythonInstall
|
|||||||
Call openLinkNewWindow
|
Call openLinkNewWindow
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Var HWND
|
|
||||||
Var DLGITEM
|
|
||||||
Var is2KXP
|
|
||||||
|
|
||||||
Function DataLocation
|
Function DataLocation
|
||||||
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" ""
|
nsDialogs::Create /NOUNLOAD 1018
|
||||||
|
|
||||||
; Set default choice
|
|
||||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "data.ini" "Field 3" "State" 1
|
|
||||||
|
|
||||||
StrCpy $R1 $winversion 2
|
|
||||||
StrCmp $R1 "NT" do_win2kxp
|
|
||||||
StrCmp $winversion "2000" do_win2kxp
|
|
||||||
StrCmp $winversion "XP" do_win2kxp
|
|
||||||
StrCmp $winversion "2003" do_win2kxp
|
|
||||||
|
|
||||||
;else...
|
|
||||||
Strcpy $is2KXP "false"
|
|
||||||
|
|
||||||
Goto continue
|
|
||||||
|
|
||||||
do_win2kXP:
|
|
||||||
Strcpy $is2KXP "true"
|
|
||||||
|
|
||||||
continue:
|
|
||||||
|
|
||||||
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "data.ini"
|
|
||||||
Pop $HWND
|
Pop $HWND
|
||||||
|
|
||||||
Strcmp $is2KXP "true" do_dlg
|
${If} $HWND == error
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
; Disable App Data option on Win9x
|
${NSD_CreateLabel} 0 0 100% 12u "Please specify where you wish to install Blender's user data files."
|
||||||
|
${NSD_CreateRadioButton} 0 20 100% 12u "Use the Application Data directory (Requires Windows 2000 or better)"
|
||||||
|
Pop $HWND_APPDATA
|
||||||
|
${NSD_CreateRadioButton} 0 50 100% 12u "Use the installation directory (ie. location chosen to install blender.exe)."
|
||||||
|
Pop $HWND_INSTDIR
|
||||||
|
${NSD_CreateRadioButton} 0 80 100% 12u "I have defined a %HOME% variable, please install files here."
|
||||||
|
Pop $HWND_HOMEDIR
|
||||||
|
|
||||||
GetDlgItem $DLGITEM $HWND 1201
|
${If} ${AtMostWinME}
|
||||||
EnableWindow $DLGITEM 0
|
GetDlgItem $0 $HWND $HWND_APPDATA
|
||||||
|
EnableWindow $0 0
|
||||||
|
SendMessage $HWND_INSTDIR ${BM_SETCHECK} 1 0
|
||||||
|
${Else}
|
||||||
|
SendMessage $HWND_APPDATA ${BM_SETCHECK} 1 0
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
do_dlg:
|
nsDialogs::Show
|
||||||
|
|
||||||
!insertmacro MUI_INSTALLOPTIONS_SHOW
|
FunctionEnd
|
||||||
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "data.ini" "Field 2" "State" ; App Dir
|
|
||||||
Strcmp $R0 1 do_app_data
|
|
||||||
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "data.ini" "Field 3" "State" ; Inst Dir
|
|
||||||
Strcmp $R0 1 do_inst_path
|
|
||||||
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "data.ini" "Field 4" "State" ; Home Dir
|
|
||||||
Strcmp $R0 1 do_home_path
|
|
||||||
|
|
||||||
Goto end
|
Function DataLocationOnLeave
|
||||||
|
StrCpy $SETUSERCONTEXT "false"
|
||||||
do_app_data:
|
${NSD_GetState} $HWND_APPDATA $R0
|
||||||
Call SetWinXPPath
|
${If} $R0 == "1"
|
||||||
Goto end
|
StrCpy $SETUSERCONTEXT "true"
|
||||||
do_home_path:
|
${Else}
|
||||||
ReadEnvStr $BLENDERHOME "HOME"
|
${NSD_GetState} $HWND_INSTDIR $R0
|
||||||
Goto end
|
${If} $R0 == "1"
|
||||||
do_inst_path:
|
|
||||||
Call SetWin9xPath
|
Call SetWin9xPath
|
||||||
end:
|
${Else}
|
||||||
|
${NSD_GetState} $HWND_HOMEDIR $R0
|
||||||
|
${If} $R0 == "1"
|
||||||
|
ReadEnvStr $BLENDERHOME "HOME"
|
||||||
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Var HWND_APPDATA_CURRENT
|
||||||
|
Var HWND_APPDATA_ALLUSERS
|
||||||
|
|
||||||
|
Function AppDataChoice
|
||||||
|
StrCmp $SETUSERCONTEXT "false" skip
|
||||||
|
|
||||||
|
nsDialogs::Create /NOUNLOAD 1018
|
||||||
|
Pop $HWND
|
||||||
|
|
||||||
|
${NSD_CreateLabel} 0 0 100% 12u "Please choose which Application Data directory to use."
|
||||||
|
${NSD_CreateRadioButton} 0 40 100% 12u "Current User"
|
||||||
|
Pop $HWND_APPDATA_CURRENT
|
||||||
|
${NSD_CreateRadioButton} 0 70 100% 12u "All Users"
|
||||||
|
Pop $HWND_APPDATA_ALLUSERS
|
||||||
|
|
||||||
|
SendMessage $HWND_APPDATA_CURRENT ${BM_SETCHECK} 1 0
|
||||||
|
|
||||||
|
StrCmp $SETUSERCONTEXT "true" 0 skip ; show dialog if we need to set context, otherwise skip it
|
||||||
|
nsDialogs::Show
|
||||||
|
|
||||||
|
skip:
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function AppDataChoiceOnLeave
|
||||||
|
StrCmp $SETUSERCONTEXT "false" skip
|
||||||
|
${NSD_GetState} $HWND_APPDATA_CURRENT $R0
|
||||||
|
${If} $R0 == "1"
|
||||||
|
Call SetWinXPPathCurrentUser
|
||||||
|
${Else}
|
||||||
|
Call SetWinXPPathAllUsers
|
||||||
|
${EndIf}
|
||||||
|
skip:
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Section "Blender-VERSION (required)" SecCopyUI
|
Section "Blender-VERSION (required)" SecCopyUI
|
||||||
SectionIn RO
|
SectionIn RO
|
||||||
|
|
||||||
; Sets $BLENDERHOME to suit Windows version...
|
|
||||||
|
|
||||||
; Set output path to the installation directory.
|
; Set output path to the installation directory.
|
||||||
SetOutPath $INSTDIR
|
SetOutPath $INSTDIR
|
||||||
; Put file there
|
; Put file there
|
||||||
|
@@ -1,34 +0,0 @@
|
|||||||
[Settings]
|
|
||||||
NumFields=4
|
|
||||||
|
|
||||||
[Field 1]
|
|
||||||
Type=label
|
|
||||||
Text=Please specify where you wish to install Blender's User Data files.
|
|
||||||
Left=0
|
|
||||||
Right=-1
|
|
||||||
Top=0
|
|
||||||
Bottom=10
|
|
||||||
|
|
||||||
[Field 2]
|
|
||||||
Type=RadioButton
|
|
||||||
Text=Use Application Data Directory (Win2k/XP only)
|
|
||||||
Left=0
|
|
||||||
Right=-1
|
|
||||||
Top=20
|
|
||||||
Bottom=30
|
|
||||||
|
|
||||||
[Field 3]
|
|
||||||
Type=RadioButton
|
|
||||||
Text=Use Installation Directory (ie. location chosen to install blender.exe).
|
|
||||||
Left=0
|
|
||||||
Right=-1
|
|
||||||
Top=40
|
|
||||||
Bottom=50
|
|
||||||
|
|
||||||
[Field 4]
|
|
||||||
Type=RadioButton
|
|
||||||
Text=I have defined a %HOME% variable, please install files here.
|
|
||||||
Left=0
|
|
||||||
Right=-1
|
|
||||||
Top=60
|
|
||||||
Bottom=70
|
|
@@ -65,6 +65,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
|
#ifdef _WIN32_IE
|
||||||
|
#undef _WIN32_IE
|
||||||
|
#endif
|
||||||
|
#define _WIN32_IE 0x0501
|
||||||
|
#include <windows.h>
|
||||||
|
#include <shlobj.h>
|
||||||
|
|
||||||
#include "BLI_winstuff.h"
|
#include "BLI_winstuff.h"
|
||||||
|
|
||||||
/* for duplicate_defgroup */
|
/* for duplicate_defgroup */
|
||||||
@@ -1167,6 +1175,8 @@ char *BLI_gethome(void) {
|
|||||||
#else /* Windows */
|
#else /* Windows */
|
||||||
char * ret;
|
char * ret;
|
||||||
static char dir[512];
|
static char dir[512];
|
||||||
|
static char appdatapath[MAXPATHLEN];
|
||||||
|
HRESULT hResult;
|
||||||
|
|
||||||
/* Check for %HOME% env var */
|
/* Check for %HOME% env var */
|
||||||
|
|
||||||
@@ -1188,9 +1198,36 @@ char *BLI_gethome(void) {
|
|||||||
|
|
||||||
|
|
||||||
/* add user profile support for WIN 2K / NT */
|
/* add user profile support for WIN 2K / NT */
|
||||||
|
hResult = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdatapath);
|
||||||
|
|
||||||
|
if (hResult == S_OK)
|
||||||
|
{
|
||||||
|
if (BLI_exists(appdatapath)) { /* from fop, also below... */
|
||||||
|
sprintf(dir, "%s\\Blender Foundation\\Blender", appdatapath);
|
||||||
|
BLI_recurdir_fileops(dir);
|
||||||
|
if (BLI_exists(dir)) {
|
||||||
|
strcat(dir,"\\.blender");
|
||||||
|
if(BLI_exists(dir)) return(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hResult = SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdatapath);
|
||||||
|
if (hResult == S_OK)
|
||||||
|
{
|
||||||
|
if (BLI_exists(appdatapath))
|
||||||
|
{ /* from fop, also below... */
|
||||||
|
sprintf(dir, "%s\\Blender Foundation\\Blender", appdatapath);
|
||||||
|
BLI_recurdir_fileops(dir);
|
||||||
|
if (BLI_exists(dir)) {
|
||||||
|
strcat(dir,"\\.blender");
|
||||||
|
if(BLI_exists(dir)) return(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
ret = getenv("USERPROFILE");
|
ret = getenv("USERPROFILE");
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (BLI_exists(ret)) { /* from fop, also below... */
|
if (BLI_exists(ret)) { /* from fop, also below...
|
||||||
sprintf(dir, "%s\\Application Data\\Blender Foundation\\Blender", ret);
|
sprintf(dir, "%s\\Application Data\\Blender Foundation\\Blender", ret);
|
||||||
BLI_recurdir_fileops(dir);
|
BLI_recurdir_fileops(dir);
|
||||||
if (BLI_exists(dir)) {
|
if (BLI_exists(dir)) {
|
||||||
@@ -1199,6 +1236,7 @@ char *BLI_gethome(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Saving in the Windows dir is less than desirable.
|
Saving in the Windows dir is less than desirable.
|
||||||
|
Reference in New Issue
Block a user