Archive: ${ConfigWrite} bug?


${ConfigWrite} bug?
Entry "foo" overwrites "foo_longer" when the entry is above "foo" in the file.At the end there are two "foo" entries with different values.
:mad:

using
${ConfigWrite} "[File]" "[Entry](blank) " "[Value]" $var
solves the problem but creates a problem with a tab/space after entry in file.A tab after entry in file therefore would not be taken as the same entry name.

Any ideas?


That's how ConfigWrite works. [Entry] is searched as is. You must include the separator there as well. In your case, that was a space, I assume.

Please use real examples next time, that was really confusing.


Solved the tab/space problem with a check on the separator.




var separator
!macro InstallEtcServices myEntry myValue
ClearErrors
StrCpy $separator " " #space
${ConfigRead} "$WINDIR\system32\drivers\etc\services" "${myEntry} " $R0 #search with tab
${If} ${Errors}
ClearErrors
${Else}
StrCpy $separator " " #tab
${EndIf}
${ConfigWrite} "$WINDIR\system32\drivers\etc\services" "${myEntry}$separator" "${myValue}" $R0
...

should be

StrCpy $separator "$\t" #tab

http://nsis.sourceforge.net/Docs/Chapter4.html#4.2.4