InstallDir can resolve (do variable/macro replacement of) $(^Name), as can WriteRegStr, but it doesn't seem like InstallDirRegKey can do this. If the end-user changes the Installation directory from:
Name "My Project"
... some statements ...
InstallDir "$PROGRAMFILES\Project Family\$(^Name)"
InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "Install_Dir"
.... more statements ...
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Install_Dir $INSTDIR
C:\Program Files\Project Family\My Project
to
C:\Temp\AlternateName
then the next installation uses
C:\Program Files\Project Family\My Project
InstallDirRegKey works ok if I don't use $(^Name):
InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\My Project" "Install_Dir"
Am I doing something wrong or leaving something out? Should I be using an actual variable rather than a "pseudo variable" like Name?
I'm helping a freeware project convert from InstallShield to NSIS, and I believe the original script was generated by the Eclipse plug-in, using the Modern UI.