kilcarman
Posts: 10
Joined: Fri Aug 14, 2009 11:13 am

Setting APPDIR to dir on a drive which may not exist

Tue Sep 01, 2009 12:42 pm

Hi

I need to set my default installdir to be a location on the E:\ drive.
For some of the users using my install, this drive may not exist but i want them to have the option to change the install location using the "Select Installation Folder" dialog.
However, if I install on a machine which does not have an E:\ drive, then I get the following error just after I launch the installer: "Invalid Drive e:\"
The installer then terminates.

I would have thought that the check to see if a drive exists could be done after the user has confirmed their Installation folder.

Does anyone know how I can set a default installation location to an alternative drive, and yet allow the user to change this if required?

Thanks
Martin

GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact:  Website

Re: Setting APPDIR to dir on a drive which may not exist

Tue Sep 01, 2009 1:12 pm

Hi,

This can not be achieved. You can however do the opposite. Leave APPDIR as is and use a custom action to check if another drive exists on the user's machine. If it does, change the APPDIR's drive to that drive, if not, leave unchanged.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

kilcarman
Posts: 10
Joined: Fri Aug 14, 2009 11:13 am

Re: Setting APPDIR to dir on a drive which may not exist

Tue Sep 01, 2009 1:35 pm

Thanks Gabriel - with regards the custom action, I guess I can use a "Property set with Formatted" action to set APPDIR to my e:\drive value if e:\ exists - my only problem is how to write the condition for checking that the e:\ drive exists?

Thanks

Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact:  Website

Re: Setting APPDIR to dir on a drive which may not exist

Tue Sep 01, 2009 2:26 pm

Hi,

Yes you can use a "Set installer property" custom action. To condition it you can try this:
-- create a new search in the Search page
-- right click the new search -> Add Location -> Folder
-- fill in the Path field like this:

Code: Select all

 E:\ 
-- now you can go to the custom action and set its Condition field to the name of the search
-- for example if your search is called DRIVE_SEARCH, the condition field should look like this:

Code: Select all

DRIVE_SEARCH
If the search doesn't find the drive the property will be empty, therefore the custom action will not run.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

kilcarman
Posts: 10
Joined: Fri Aug 14, 2009 11:13 am

Re: Setting APPDIR to dir on a drive which may not exist

Tue Sep 01, 2009 3:41 pm

Thanks Bogdan

I have put the custom action in the InstallUISequence under CostInitialize and when I run the installer in interactive mode it works perfectly.

However, I also need this behaviour for silent installs - how can i get this Custom Action to be executed in Silent Mode.

Thanks for you help
Martin

Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact:  Website

Re: Setting APPDIR to dir on a drive which may not exist

Tue Sep 01, 2009 4:15 pm

Hi,

Here is what you can try:
-- right click on InstallExecuteSequence -> Show Standard Actions -> CostInitialize
-- now press [Shift] key and drag and drop the custom action from the InstalUISequence to the CostInitialize phase from the InstallExecuteSequence
-- this will share the custom action and allow it to run in Silent Mode.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

kilcarman
Posts: 10
Joined: Fri Aug 14, 2009 11:13 am

Re: Setting APPDIR to dir on a drive which may not exist

Thu Sep 03, 2009 11:26 am

Thanks Bogdan -that works perfectly!
Regards,
Martin

Return to “Common Problems”