Installer: Fixed that Rainmeter.ini in Program Files was not moved correctly in some cases

This commit is contained in:
Birunthan Mohanathas 2012-04-29 15:18:48 +03:00
parent 0ec27ccf6c
commit 97656ad6bc

View File

@ -385,7 +385,7 @@ Function PageOptionsDirectoryOnChange
GetDlgItem $1 $HWNDPARENT 1 GetDlgItem $1 $HWNDPARENT 1
${GetRoot} $0 $2 ${GetRoot} $0 $2
${DriveSpace} "$2\" "/D=F /S=M" $3 ${DriveSpace} "$2\" "/D=F /S=M" $3
${If} $3 < REQUIREDSPACE ${If} $3 < ${REQUIREDSPACE}
EnableWindow $1 0 EnableWindow $1 0
${Else} ${Else}
EnableWindow $1 1 EnableWindow $1 1
@ -556,9 +556,9 @@ Section
ExecWait '"$PLUGINSDIR\vcredist.exe" /q /norestart' $0 ExecWait '"$PLUGINSDIR\vcredist.exe" /q /norestart' $0
Delete "$PLUGINSDIR\vcredist.exe" Delete "$PLUGINSDIR\vcredist.exe"
${If} $0 == "3010" ${If} $0 == 3010
SetRebootFlag true SetRebootFlag true
${ElseIf} $0 != "0" ${ElseIf} $0 != 0
MessageBox MB_OK|MB_ICONSTOP "$(VCINSTERROR)" MessageBox MB_OK|MB_ICONSTOP "$(VCINSTERROR)"
Quit Quit
${EndIf} ${EndIf}
@ -598,9 +598,9 @@ Section
ExecWait '"$PLUGINSDIR\dotnetfx.exe" /q:a /c:"install /q"' $0 ExecWait '"$PLUGINSDIR\dotnetfx.exe" /q:a /c:"install /q"' $0
Delete "$PLUGINSDIR\dotnetfx.exe" Delete "$PLUGINSDIR\dotnetfx.exe"
${If} $0 == "3010" ${If} $0 == 3010
SetRebootFlag true SetRebootFlag true
${ElseIf} $0 != "0" ${ElseIf} $0 != 0
MessageBox MB_OK|MB_ICONSTOP "$(DOTNETINSTERROR)" MessageBox MB_OK|MB_ICONSTOP "$(DOTNETINSTERROR)"
Quit Quit
${EndIf} ${EndIf}
@ -637,22 +637,21 @@ Section
Sleep 500 Sleep 500
${Next} ${Next}
; Check if Rainmeter.ini is located in the installation folder and ; Move Rainmeter.ini to %APPDATA% if needed
; if the installation folder is in Program Files
${IfNot} ${Silent} ${IfNot} ${Silent}
${AndIf} ${FileExists} "$INSTDIR\Rainmeter.ini" ${AndIf} ${FileExists} "$INSTDIR\Rainmeter.ini"
${If} $InstallPortable != 1 ${If} $InstallPortable != 1
!ifdef X64 ${If} $Install64Bit == 1
StrCmp $INSTDIR "$PROGRAMFILES64\Rainmeter" 0 RainmeterIniDoesntExistLabel ${AndIf} "$INSTDIR" == "$PROGRAMFILES64\Rainmeter"
!else ${OrIf} "$INSTDIR" == "$PROGRAMFILES\Rainmeter"
StrCmp $INSTDIR "$PROGRAMFILES\Rainmeter" 0 RainmeterIniDoesntExistLabel MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(SETTINGSFILEERROR)" IDNO SkipIniMove
!endif StrCpy $0 1
!insertmacro UAC_AsUser_Call Function CopyIniToAppData ${UAC_SYNCREGISTERS}
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(SETTINGSFILEERROR)" IDNO RainmeterIniDoesntExistLabel ${If} $0 == 1
CreateDirectory $APPDATA\Rainmeter ; Copy succeeded
Rename "$INSTDIR\Rainmeter.ini" "$APPDATA\Rainmeter\Rainmeter.ini" Delete "$INSTDIR\Rainmeter.ini"
${If} ${Errors} ${EndIf}
MessageBox MB_OK|MB_ICONSTOP "$(SETTINGSMOVEERROR)" SkipIniMove:
${EndIf} ${EndIf}
${Else} ${Else}
ReadINIStr $0 "$INSTDIR\Rainmeter.ini" "Rainmeter" "SkinPath" ReadINIStr $0 "$INSTDIR\Rainmeter.ini" "Rainmeter" "SkinPath"
@ -662,7 +661,6 @@ Section
${EndIf} ${EndIf}
${EndIf} ${EndIf}
RainmeterIniDoesntExistLabel:
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
Delete "$INSTDIR\Rainmeter.exe.config" Delete "$INSTDIR\Rainmeter.exe.config"
Delete "$INSTDIR\Rainmeter.chm" Delete "$INSTDIR\Rainmeter.chm"
@ -747,6 +745,16 @@ RainmeterIniDoesntExistLabel:
${EndIf} ${EndIf}
SectionEnd SectionEnd
Function CopyIniToAppData
ClearErrors
CreateDirectory "$APPDATA\Rainmeter"
CopyFiles /SILENT "$INSTDIR\Rainmeter.ini" "$APPDATA\Rainmeter\Rainmeter.ini"
${If} ${Errors}
StrCpy $0 0
MessageBox MB_OK|MB_ICONSTOP "$(SETTINGSMOVEERROR)"
${EndIf}
FunctionEnd
Function RemoveStartMenuShortcuts Function RemoveStartMenuShortcuts
!insertmacro RemoveStartMenuShortcuts "$SMPROGRAMS\Rainmeter" !insertmacro RemoveStartMenuShortcuts "$SMPROGRAMS\Rainmeter"
FunctionEnd FunctionEnd