Archive: ReadINIStr with quotes


ReadINIStr with quotes
i have an ini-file looking like this

[section]
this=this "works"
that="this doesn't work"

i'm trying to find a way to use ReadINIStr on that without it swallowing the quotes. i've tried all kinds of quotes on the ReadINIStr command, but the string will always lack the quotes.

is there any way to fix this? i might escape the quotes when i write them to the ini-file, but due to the history of the installer i'd prefer another way.

thanks


for clarification

ReadINIStr $0 "file.ini" "section" "this"
# $0=this "works"

ReadINIStr $0 "file.ini" "section" "that"
# $0=this doesn't work
ReadINIStr $0 'file.ini' 'section' 'that'
# $0=this doesn't work
ReadINIStr $0 ´file.ini´ ´section´ ´that´
# $0=this doesn't work

ClearErrors
FileOpen $0 $INSTDIR\file.ini r
IfErrors done

loop:
FileRead $0 $1
IfErrors close
${If} $1 = [section]
loop2:
FileRead $0 $1
StrCpy $2 $1 1
${If} $2 == [
goto close
${EndIf}
StrCpy $2 $1 4
${If} $2 == that
StrCpy $2 $1 "" 5
DetailPrint $2
${EndIf}
goto loop2
${EndIf}
goto loop

close:
FileClose $0
done:


Note that this assumes that there's only one [section] block.

thanks, will give this a try

would you say that this is the desired behaviour of readinistr or should it be considered a bug?


As far as I know, the ini functions just call the standard win32 API. My guess is that that would mean it's as desired.


IMHO this is a bug in the windows ini functions... (cmd.exe has the same stupid quote stripping behavior so there has to be a reason, I just don't know what it is)