congahonga
11th December 2008 11:38 UTC
Need the $INSTDIR value with double bashlashes
Hi there,
a question, to that I can't find a solution for.
In the variable $INSTDIR I can get the variabel installation directory. Thats clear.
But the problem is, that I need DOUBLE Bashlashes, because I must put an entry in Windows Registry. Its not my programme, i only write the installer, and there must be DOUBLE Bashlashes in Registry. I can't change the programm that reads that info from Registry.
example:
$INSTDIR ="c:\programmfiles\software"
I need to write in Registry
[HKEY_LOCAL_MACHINE\SOFTWARE\VARIABLE]
"Config"="c:\\programmfiles\\software"
How can I double the Backslashes in $INSTDIR ?
Anders
11th December 2008 16:13 UTC
you could just write it using WriteRegStr and not use a .reg file, but if you really want to go that route, just get down and dirty with StrLen and StrCpy in a loop
Animaether
12th December 2008 06:38 UTC
or using the string functions that come with NSIS:
!include "StrFunc.nsh"
${StrRep}
Name "Test"
OutFile "SetupTest.exe"
InstallDir "$PROGRAMFILES\Test"
Section "A" "aSection"
StrCpy $1 "c:\programmfiles\software"
MessageBox MB_OK "before: $1"
${StrRep} $1 $1 "\" "\\"
MessageBox MB_OK "after: $1"
SectionEnd
congahonga
15th December 2008 13:01 UTC
Is that also possible ?
I could use ${WordReplace}, couldn't I ?
But it's strange because HM NIS Edit doesn't no the
command ${WordReplace}...
yeah...I am a newbe to NSIS...could please somebody give me a hint ?
Animaether
15th December 2008 14:35 UTC
sure - just as you could use ${StrRep} (*points up*)
Just include the correct header file near the top of your script...
!include "StrFunc.nsh"
or
!include "WordFunc.nsh"
These files are in the Include folder of your NSIS installation.