PortableApps.com Platform and Suite 1.6 have been released.
BUGFIX: ReadINIStrWithDefault.nsh 1.1 (2009-05-12)![]() Submitted by John T. Haller on May 12, 2009 - 1:27pm
I've discovered a bug in the ReadINIStrWithDefault.nsh macro file I wrote that we use with many of our releases. Specifically $0 and $2 are accidentally swapped by the macro. I'm guessing that we haven't noticed it because most of the variables we use are defined and we only use the macro at the very beginning of our launchers before we make use of any of the other variables, but it could be affecting some launchers out there. Here is the updated macro that fixes the issue: ; ReadINIStrWithDefault 1.1 (2009-05-12)
;
; Substitutes a default value if the INI is undefined
; Copyright 2008-2009 John T. Haller of PortableApps.com
; Released under the BSD
;
; Usage: ${ReadINIStrWithDefault} OUTPUT_VALUE INI_FILENAME SECTION_NAME ENTRY_NAME DEFAULT_VALUE
;
; History:
; 1.1 (2009-05-12): Fixed error with $0 and $2 being swapped
Function ReadINIStrWithDefault
;Start with a clean slate
ClearErrors
;Get our parameters
Exch $0 ;DEFAULT_VALUE
Exch
Exch $1 ;ENTRY_NAME
Exch 2
Exch $2 ;SECTION_NAME
Exch 3
Exch $3 ;INI_FILENAME
Push $4 ;OUTPUT_VALUE
;Read from the INI
ReadINIStr $4 $3 $2 $1
IfErrors 0 +3
StrCpy $4 $0
ClearErrors
;Keep the variable for last
StrCpy $0 $4
;Clear the stack
Pop $4
Pop $3
Exch 2
Pop $2
Pop $1
;Reset the last variable and leave our result on the stack
Exch $0
FunctionEnd
!macro ReadINIStrWithDefault OUTPUT_VALUE INI_FILENAME SECTION_NAME ENTRY_NAME DEFAULT_VALUE
Push `${INI_FILENAME}`
Push `${SECTION_NAME}`
Push `${ENTRY_NAME}`
Push `${DEFAULT_VALUE}`
Call ReadINIStrWithDefault
Pop `${OUTPUT_VALUE}`
!macroend
!define ReadINIStrWithDefault '!insertmacro "ReadINIStrWithDefault"'Developers, please double check your launchers and ensure that this doesn't affect your current releases in any way. If it does, we'll do a revision (as I'm doing revisions on all apps for Win7 anyway). If it does not, we'll need to be sure to get the macro into the next release. ( categories: )
|



Hmmm,
is there a reason why you don't use that for the latest official releases (e.g. WinMerge)? I'm just curious.
Oh, btw. the WinMerge DefaultData isn't used, I guess it could be deleted.