Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Bug? ReadINIStr path param can't have quotes (http://forums.winamp.com/showthread.php?t=205557)

dddddppppp 21st January 2005 20:14

Bug? ReadINIStr path param can't have quotes
 
I'm trying to use ReadINIStr like this,

ReadINIStr $R2 "$INI_PATH" foo InstDir

and I'm getting the value of $INI_PATH via the widely-used GetParameterValue function for reading from the cmdline. When I log the value of INI_PATH that I get this way, it's

"C:\DOCUME~1\DPBLUE~1\LOCALS~1\Temp\inst.ini"

I just tried two alternative ways of setting $INI_PATH using $TEMP and $PROFILE, like this:

StrCpy $INI_PATH "$TEMP\inst.ini"

StrCpy $INI_PATH "$PROFILE\Local Settings\Temp\inst.ini"

Using $TEMP, ReadINIStr succeeded, and the value of INI_PATH was logged as:

C:\DOCUME~1\DPBLUE~1\LOCALS~1\Temp\inst.ini

And using $PROFILE, ReadINIStr again succeeded, and the value of INI_PATH was logged as:

C:\Documents and Settings\dpbluegreen7\Local Settings\Temp\inst.ini

So the problem appears to be the double-quotes around the path that I get from GetParameterValue.

This led me to think that the double-quotes around $INI_PATH in the ReadINIStr call might be the problem,

ReadINIStr $R2 "$INI_PATH" foo InstDir

but removing those quotes still led to an error.

When I re-add the quotes around $INI_PATH in the ReadINIStr call, and strip the quotes from the value I get from GetParameterValue like this,

StrLen $LEN_WO_QUOTES $INI_PATH
IntOp $LEN_WO_QUOTES $LEN_WO_QUOTES - 2
StrCpy $INI_PATH $INI_PATH $LEN_WO_QUOTES 1

it works!

This seems like a bug in ReadINIStr. We were using 2.0 when this problem was discovered, but I just tried 2.04 and have the same problem.

kichik 21st January 2005 20:25

It's not a bug with ReadINIStr. The path with the quotes is invalid. A path can't contain quotes. When you use:
code:
ReadINIStr $R2 "$INI_PATH" foo InstDir
you simply tell NSIS that everything between the quotes is the path. The quotes are not considered a part of the path. The quotes are used to group several words, separated with spaces, into one parameter.


All times are GMT. The time now is 05:03.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.