Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 24th May 2012, 11:06   #1
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,164
Send a message via ICQ to Yathosho
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
Yathosho is online now   Reply With Quote
Old 24th May 2012, 11:10   #2
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,164
Send a message via ICQ to Yathosho
for clarification
code:
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

Yathosho is online now   Reply With Quote
Old 24th May 2012, 11:58   #3
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,840
code:
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.
MSG is online now   Reply With Quote
Old 24th May 2012, 12:03   #4
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,164
Send a message via ICQ to Yathosho
thanks, will give this a try

would you say that this is the desired behaviour of readinistr or should it be considered a bug?
Yathosho is online now   Reply With Quote
Old 24th May 2012, 12:13   #5
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,840
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.
MSG is online now   Reply With Quote
Old 24th May 2012, 19:29   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,775
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)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump