Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   how to use StrRep (http://forums.winamp.com/showthread.php?t=234233)

jhegge 28th December 2005 21:22

how to use StrRep
 
I need to convert $INSTDIR for a Java properties file, so I have to replace the back slashes with forward slashes in the path.

I read about StrRep but I don't understand the syntax for using this function/macro.

In a Function, I write this:

code:

!include StrFunc.nsh
...

Function configure
...

StrCpy $5 $INSTDIR
Push "$5"
Push "\"
Push "/"
Call StrRep
Pop "$6"


...
FunctionEnd



This results in:

Processed 1 file, writing output:
Adding plug-ins initializing function... Done!
Error: resolving install function "StrRep" in function "configure"
Note: uninstall functions must begin with "un.", and install functions must not
Error - aborting creation process


If I called it as the example here, http://nsis.sourceforge.net/StrRep, suggests, I get an argument error.

code:

${StrRep} $5 $INSTDIR "\" "/"



!insertmacro: macro "FUNCTION_STRING_StrRep" requires 0 parameter(s), passed 4!


Can someone please explain how to use/setup. Thanks.

deguix 29th December 2005 13:02

Wiki's StrRep function is a little different from that in StrFunc header. If you use the header, you should use ${StrRep} first outside of sections and functions and before you use it to implement the actual function (or the error you described happens). For else, it's the same.

I plan in the future to replace that header with UseFunc so that this easy inclusion syntax found on this StrFunc header can be exploited more.


All times are GMT. The time now is 04:57.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.