I found in NSIS\Examples\bigtest.nsi an example that uses InstallDirRegKey
When i test the script $INSTDIR is not set properly. I changed the script to
InstallDirRegKey HKLM "Software\NSISTest\BigNSISTest" ""
And now $INSTDIR is set to the correct path read on the registry.
InstallDirRegKey HKLM "Software\NSISTest\BigNSISTest" "Install_Dir"
I tried to put InstallDirRegKey in my own script but $INSTDIR is always set to InstallDir.
I found a workaround in NSIS Manual that consists of
But i was wondering why i was not able to make InstallDirRegKey work...
Function .onInit
...
ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
StrCmp $INSTDIR "" label1 label2
...
FunctionEnd
If anyone has an idea what i could do wrong.
i used EclipseNSIS wizard to make my script with MUI interface
I also used dumpstate::debug to set breakpoint to see what was the value of $INSTDIR and found it was set to InstallDir but was unable to debug InstallDirRegKey.
...
!define REGKEY "SOFTWARE\${COMPANY}\$(^Name)"
...
InstallDir "$PROGRAMFILES\$(^Name)\"
InstallDirRegKey HKLM "${REGKEY}" "Path"
...