Skip to content
⌘ NSIS Forum Archive

Installdir from Registrypath ... but how to go to ..\ - 2 Questions

3 posts

TobWen#

Installdir from Registrypath ... but how to go to ..\ - 2 Questions

Hi there,

I am getting my installdir from the uninstallpath in the registry.

InstallDirRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\TobWen "UninstallString"

Returning is "C:\progs\bla bla\runme"

How can I go back to "C:\progs\bla bla" and set it as $INSTDIR ?


Another question is:
SetOutPath $PROGRAMFILES\TobWen
CreateDirectory "bla bla"
SetOutPath "bla bla"
File ....

Where is the error?
It copies the files anywhere ... but not into this directory.

Thanks
Tobias
justin#
To get the parent dir, use the GetParent function that is in
functions.htm. i.e.:


Function GetParent
Exch $0 ; old $0 is on top of stack
Push $1
Push $2
StrCpy $1 -1
loop:
StrCpy $2 $0 1 $1
StrCmp $2 "" exit
StrCmp $2 "\" exit
IntOp $1 $1 - 1
Goto loop
exit:
StrCpy $0 $0 $1
Pop $2
Pop $1
Exch $0 ; put $0 on top of stack, restore $0 to original value
FunctionEnd

...

and in your first section, something like:

Push $INSTDIR
Call GetParent
Pop $INSTDIR


As for the second question, what are you doing wrong, do this:


SetOutPath $PROGRAMFILES\TobWen
...
SetOutPath "$OUTDIR\bla bla"
File..
or, if you want to do it more quickly, use:

SetOutPath "$PROGRAMFILES\TobWen\bla blah"
note that setOutPath creates the directory as well.

-Justin