Chilli24
17th January 2005 12:21 UTC
Why doesn't this work?
Hi...I don't know why doesn't this work:
InstallDirRegKey HKLM "Software\MyCompany\MyKey" "Root path"
Function .onInit
StrCpy $INSTDIR InstallDirRegKey\folder1
FunctionEnd
Section "Copy files" SEC01
SetOutPath $INSTDIR\Components
SetOverwrite on
File "source\${DLLname1}"
File "source\${DLLname2}"
SectionEnd
When I run this install the path is shown as: "InstallDirRegKey\folder1"...i want it to be "C:\rootFolder\folder1", where "C:\rootFolder" is in the registry.
So, can anyone help me? I'm a newbie :)...Thanks.
Takhir
17th January 2005 12:43 UTC
StrCpy $INSTDIR "$INSTDIR\folder1"
Chilli24
17th January 2005 12:58 UTC
Thanks Takhir but I want to use InstallDirRegKey, not INSTDIR. I want the installer to take the path from regisstry, not to be predefined by me. Can you help me with that?
Takhir
17th January 2005 13:09 UTC
InstallDirRegKey is Attribute, not a variable.
"This attribute tells the installer to check a string in the registry, and use it for the install dir if that string is valid. If this attribute is present, it will override the InstallDir attribute if the registry key is valid, otherwise it will fall back to the InstallDir default."
So installer reads InstallDirRegKey to $INSTDIR if key is valid or uses InstallDir attribute otherwise.
Chilli24
17th January 2005 13:16 UTC
I have done exactly like you said but it's just showing me : "\folder1".
Takhir
17th January 2005 13:27 UTC
Before sending first reply I tested attached script on my Win2K server, NSIS 2.04 and I could see correct paths. The question may be when installer checks for InstallDirRegKey in the registry, but this is strange... It looks like your registry node exists and it's value is "" or registry has not this string and InstallDir is not defined.
Chilli24
17th January 2005 13:57 UTC
Thanks man...The problem was that I have entered the path in the registry wrong.Now it works.