Archive: How to detect failure of /D=install_dir


How to detect failure of /D=install_dir
Hi,
if the installation directory is specified by means of /D=... it may happen that INSTDIR isn't set to this value, e.g. if the installation directory cannot be created because of a file with the directory name that already exist in the same parent dir). Bug 1842326 seams to address the same problem.

Since /D is optional how can I detect whether /D has been specified but rejected?


The directory passed on the command line is just ignored if the directory is invalid. You can set InstallDir to nothing, or a special directory and compare $INSTDIR to that in .onInit. If the directory from the command line is ignored, that would be the value of $INSTDIR.


OK, but if InstallDir is set to any pattern and the value of $INSTDIR gets this value, how can I differ between /D that has not been set and /D that has been set with an invalid value? I.e., how can I detect the error to inform the caller?


You can't detect an error. You can only detect that InstallDir was used.


So this is a bug in my opinion. It's required to inform the caller of the setup that the specified directory could not be used. E.g., if the customer optionally wants to integrate the setup into another, higher-ranking setup and the latter depends on a successful installation into the specified directory there is no chance to recognize this error.

If there is no other workaround I have to implement my own command line parameter :-(