cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rjdunnill
Level 3

How to change the value of INSTALLDIR at runtime?

We have a Basic MSI project which needs to copy its files to a location which differs at runtime.

I have tried setting INSTALLDIR's value at runtime with a Custom Action. This works in the debugger, but not if the MSI file is moved to another folder and run from there, outside of the debugger.

Is there a specific event at which point INSTALLDIR can be programmatically set? 

The code we are using is as follows

function AfterXXX(hMSI)
    // To Do: Declare local variables.
    STRING szMsg;
    NUMBER nResult;
begin
    if (!SetXXXFolders()) then
        szMsg = "Unable to retrieve XXX install path. The installation will not continue.";
       MessageBox(szMsg, SEVERE);
       return ERROR_INSTALL_FAILURE;
    endif;

    // Change the value of INSTALLDIR
    INSTALLDIR = szPrograms;
   

    return ERROR_SUCCESS;
end;

Labels (1)
0 Kudos
(0) Replies