eladef
Flexera beginner

Installing component parallel to the INSTALLDIR

Hi

I have basic MSI project
Is there a way I can set up components to be installed in parallel to the INSTALLDIR ?
So in case the user choose to install under C:\COMPANY\MAIN ( which is the INSTALLDIR ),
several components will be installed under DIR2, like this
C:\COMPANY\MAIN
C:\COMPANY\DIR2
Labels (1)
0 Kudos
3 Replies
liorafar
Pilgrim

For each component you also have "Destination" field.
Therefore, just type there the wanted location - in your case "C:\COMPANY\DIR2" instead of [INSTALLDIR]
If you dont want the components to have hard coded destination, then define your INSTALLDIR as : C:\COMPANY and then in the component destination field put
[INSTALLDIR]\MAIN or [INSTALLDIR]\DIR2
This way you can install different components to different destination regarding to your INSTALLDIR
0 Kudos
eladef
Flexera beginner

I guess I wasn't clear enough
the C:\COMPANY\MAIN was just an example it could be anything only the DIR2 folder is fixed.

To accomplish what I want I have a CA that get the parent of the INSTALLDIR
and using MsiSetTargetPath set the directory path to the components I need to install n parallel to INSTALLDIR
This work well but I wonder if there is a better way
0 Kudos
ch_eng
Flexera beginner

I don't how/if this would work in a Basic MSI project, but this is how I get it to work in InstallScript MSI. It takes the value of INSTALLDIR, clips off the last folder and replaces it with "MyFeature":

1) Set the Feature/Component Destinations for the feature(s) you want in "C:\COMPANY\DIR2" to a directory identifier called INSTALLDIR_MYFEATURE with some fake value (ex ##INSTALLDIR_MYFEATURE_FAKE##)

2) After Dlg_SdAskDestPath is called (where the user determines where they want your program installed), call this custom function by passing it the regular INSTALLDIR string:

Prototype:
prototype STRING MyFeature_GetMyFeatureInstallDir( byval STRING );	// szInstallDir


Function:
function STRING MyFeature_GetMyFeatureInstallDir( szInstallDir )
LIST lstInstallDir;
STRING svMyFeatureInstallDir, svPathPart;
NUMBER i;
begin

lstInstallDir = ListCreate( STRINGLIST );
// determine what value INSTALLDIR_MYFEATURE should have:
StrGetTokens( lstInstallDir, szInstallDir, "\\" );
svMyFeatureInstallDir = "";
for i = 0 to ListCount( lstInstallDir ) - 2
ListSetIndex( lstInstallDir, i );
ListCurrentString( lstInstallDir, svPathPart );
if svMyFeatureInstallDir != "" then
svMyFeatureInstallDir = svMyFeatureInstallDir + "\\" + svPathPart;
else
svMyFeatureInstallDir = svPathPart;
endif;
endfor;
svMyFeatureInstallDir = svMyFeatureInstallDir ^ "MyFeature";
MsiSetProperty( ISMSI_HANDLE, "INSTALLDIR_MYFEATURE", svMyFeatureInstallDir );
return svMyFeatureInstallDir;

end;


3) the following line from that function is what sets the correct value for the Feature/Component destinations:
    MsiSetProperty( ISMSI_HANDLE, "INSTALLDIR_MYFEATURE", svMyFeatureInstallDir );


Again, I don't work with Basic MSI projects but hopefully this will give you an idea of how it can be done.

HTH
0 Kudos