Archive: $PROGRAMFILES Default Won't Change


$PROGRAMFILES Default Won't Change
Hi All,

I am new with this tool and I've created an install setup.exe that works perfectly when I install to the default location of $PROGRAMFILES\MyAPP

However, during an install, if I change the install-to dirctory to something else, it installs to $PROGRAMFILES anyway and creates a shortcut in the target directory of my choosing. Perhaps $PROGRAMFILES is the wrong choice but in reviewing the docs, I didn't see a better option.

Thanks,
Scott


Is there the instruction SetOutPath "$INSTDIR" on the top of your section?


Here is what I see.

Section "MainSection" SEC01
SetOutPath "$PROGRAMFILES\sqlsnap\apache-tomcat-6.0.16\bin"
SetOverwrite try
File "..\SQLsnap_Install_Clean\apache-tomcat-6.0.16\bin\bootstrap.jar"
File "..\SQLsnap_Install_Clean\apache-tomcat-6.0.16\bin\catalina-tasks.xml"
File "..\SQLsnap_Install_Clean\apache-tomcat-6.0.16\bin\catalina.bat"
File "..\SQLsnap_Install_Clean\apache-tomcat-6.0.16\bin\catalina.sh"
File "..\SQLsnap_Install_Clean\apache-tomcat-6.0.16\bin\commons-daemon.jar" ....

...

Thanks for your help!


SetOutPath "$PROGRAMFILES\sqlsnap\apache-tomcat-6.0.16\bin" is wrong.
It has to be SetOutPath "$INSTDIR" otherwise you install to "$PROGRAMFILES\sqlsnap\apache-tomcat-6.0.16\bin" no matter what users selected in directory page.


Thanks! I appreciate your help.


OK, that worked. now it installs in the correct location if I choose not to take the default...however, now the default location is all goofed up when the Choose Install Location panel shows up. How can I force it to $PROGRAMFILES\myapp every single time. Here is a snippet of my code:


Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\sqlsnap"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
SetOutPath "$INSTDIR\snapsql"
SetOverwrite try
File "..\SQLsnap_Install_Clean\apache-tomcat-6.0.16\bin\bootstrap.jar"
....

Also, is there away to execute a file after everything is installed in the target directory? I'd rather not allow the user to check/un-check the box to Run the app. I'd rather control that it gets run within the install itself. In this case its a .bat file.

Thanks!@!


InstallDir "$PROGRAMFILES\sqlsnap"
......
......
......
SetOutPath "$INSTDIR"

Remove the directory page so users won't have the choice to select/change the target path.

You can execute a bat file within your section with included plugin nsExec. Or in the function .onInstSuccess if you prefer to launch it at the very end of the installation.