Skip to content
⌘ NSIS Forum Archive

To append the predef. install folder at every "Browse" button usage

6 posts

Maxim30#

To append the predef. install folder at every "Browse" button usage

Hello,
I do not find in the doc the explanation to append the predefined path to the installation folder at install time.
Having to build toghether a setup for 32 and 64 bit I have written this code in my beginning function:

Function MyGUIInit
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Nome}" "NSIS:InstallDir"
${If} $0 != ""
StrCpy $INSTDIR $0
${ElseIf} ${RunningX64}
StrCpy $INSTDIR "$PROGRAMFILES64\${Nome}"
${Else}
StrCpy $INSTDIR "$PROGRAMFILES32\${Nome}"
${EndIf}
....
FunctionEnd

I do not use the attribute InstallDir in the code.

How can I append my predefined installation folder ${Nome} at every "Browse" button usage at install time ?

Greetings
Maxim30#
Ok, but what should I write in the function ?

Is the following right ?

Function .onVerifyInstDir
StrCpy $INSTDIR "$INSTDIR\${Nome}"
FunctionEnd

I would this:

example 1:
if user chooses as install folder the path c:\program files\NNN then Nsis setup will make it becoming c:\program files\NNN\MyFolder where MyFolder is specified inside the variable ${Nome}

example 2:
if user chooses as install folder the path c:\program files\QQQQQQQQQQQQQQ then Nsis setup will make it becoming c:\program files\QQQQQQQQQQQ\MyFolder where MyFolder is specified inside the variable ${Nome}

Does the funcion .onVerifyInstDir make it ?
Maxim30#
Hello,
I have fixed better the function within

Function .onVerifyInstDir
StrCpy $INSTDIR "$INSTDIR\${Nome}"
FunctionEnd

by instead

${WordAdd} "$INSTDIR" "\" "+${Nome}" $INSTDIR

Greetings,
Maxim30#
Hello,
I have fixed more better 🙂 the function above deleting the "+":

Function .onVerifyInstDir
StrCpy $INSTDIR "$INSTDIR\${Nome}"
FunctionEnd

by instead

${WordAdd} "$INSTDIR" "\" "${Nome}" $INSTDIR

Greetings,