Yathosho
17th February 2003 10:51 UTC
NSIS2.0b1 bug with InstallDir
i got a script that queries the registry for the path of some software. since i upgraded to b1, i get the following bug:
instead of displaying C:\Program Files\Software, it leaves the ":" and displays C\Program Files\Software instead.
ReadRegStr $3 HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3"
"UninstallString"
>StrCmp $3 "" Winamp2Check StripPath3
Winamp2Check:
>ReadRegStr $2 HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp"
"UninstallString"
>StrCmp $2 "" End StripPath2
StripPath3:
StrCpy $INSTDIR $3
Call StripPath
Goto End
>
please help.
kichik
17th February 2003 13:28 UTC
Can you please attach the entire script so I can see StripPath too?
dirtydingus
17th February 2003 17:43 UTC
This seems to be similar to the $EXEDIR bug I just reported, although the $EXEDIR bug only occurs when $EXEDIR is the root of a drive.
DD
Yathosho
19th February 2003 11:40 UTC
by Frank Nagel
>Function StripPath
Push$8
Push$9
StrCmp $INSTDIR"" fin
StrCpy$8 $INSTDIR 1 0 ; get firstchar
StrCmp$8 '"' "" getparent
; if first char is ", let's remove "'s first.
StrCpy $INSTDIR $INSTDIR "" 1
StrCpy $8 0
rqloop:
StrCpy $9 $INSTDIR 1 $8
StrCmp $9 '"' rqdone
StrCmp $9 "" rqdone
IntOp $8 $8 + 1
Goto rqloop
rqdone:
StrCpy $INSTDIR $INSTDIR $8
getparent:
; the uninstall string goes to an EXE, let's get the directory.
StrCpy $8 -1
gploop:
StrCpy $9 $INSTDIR 1 $8
StrCmp $9 "" gpexit
StrCmp $9 "" gpexit
IntOp $8 $8 - 1
Goto gploop
gpexit:
StrCpy $INSTDIR $INSTDIR $8
fin:
Pop $9
Pop $8
FunctionEnd
>
kichik
19th February 2003 16:01 UTC
This function is no longer useful. I don't know which part exactly ruins it but the first part is useless because NSIS takes care of the quotes now and the second part does nothing but copying $INSTDIR to $INSTDIR. You can safely remove that function.
Yathosho
19th February 2003 17:11 UTC
but my registry entry points to an .EXE file, but i just need the path
kichik
19th February 2003 17:34 UTC
OK. What you need to do is to first parse the install directory you get from the registry first and only then copy it to $INSTDIR. The problem is that $INSTDIR is automatically corrected and therefore can neveer contain any invalid data such as what you insert into it.