adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

APPDIR> inconsistent trailing backslash

I'm running into an issue where a script I'm running will fail depending on whether APPDIR ends with a backslash.

When the backslash is there, all is well; when it's absent, the following line:

Code: Select all

if not "%CATALINA_HOME%" == "" goto gotHome
returns the following error:
MSI (s) (DC:98) [14:48:44:201]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI4F25.tmp, Entrypoint: CreateExeProcess
/f" == "" goto gotHome was unexpected at this time.
The root cause is

Code: Select all

cmd.exe /c reg add "hkcu\Environment" /v CATALINA_HOME /t reg_sz /d "[APPDIR]" /f
which will set CATALINA_HOME to be /f" instead of the actual installation path.

Originally I'd found that per user installation paths didn't contain the training backspace and per machine install paths did, so i'd setup my install button in my dialog to call the custom action with either "[APPDIR]" or "[APPDIR]\" as required, but it seems that per machine installations sometimes contain the backslash and sometimes don't (when upgrading the installer to a new version and installing over top of an existing installation I'll get a failure the first time but re-running it will result in a clean re-installation).
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: APPDIR> inconsistent trailing backslash

Hello,

Please keep in mind that the "APPDIR" property is always resolved without the trailing backslash character if it is used before "Paths Resolution -> CostFinalize" standard action. Also, after the "CostFinalize" action its value should contain the trailing backslash character. So, if your custom action (using the [APPDIR] property) is triggered before the "CostFinalize" action, then you should explicitly add the "\" charcater after [APPDIR] property.

Also, you can take a look on our "Windows Installer Folders" article which should be useful for you.

If you have any questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Re: APPDIR> inconsistent trailing backslash

Daniel wrote:Please keep in mind that the "APPDIR" property is always resolved without the trailing backslash character if it is used before "Paths Resolution -> CostFinalize" standard action. Also, after the "CostFinalize" action its value should contain the trailing backslash character.
The only change is per user vs per machine installation (the script is run at the same time for both). I'll try to revert my .aip to send in, but it could take some time as deadlines are looming here.

I've also run across inconsistencies in [APPDIR] in the case where my [Manufacturer] contains a period at the end; I assume this is due to the timing mentioned above.

Return to “Common Problems”