liuyt1
Posts: 25
Joined: Sun Aug 02, 2015 10:18 pm

how to detect biggest free disk

hi AI,

My program will generate lots data file.
I need create one folder dialog which allow user to select data file folder.
I want to give default value which is depends on which drive has most free space.
Like if c:\ has 500GB, and e:\ has 2TB free space.

Then the PathEdit control default value will be "e:\DataFile".

Also it is possible I give one text control which will show disk free space after use change the default folder?
like at begin, PathEdit default value is "e:\DataFile", and text control value is "2TB free".
If user change to "c:\DataFile", then the text control should change to "500GB "

Thanks,
YT
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: how to detect biggest free disk

Hello,

In order to set the default installation path to the volume where most free space is available, you need to create a custom action. For details, please take a look on the How do I create fully fledged C# custom actions? article with related information for hints and guidance.

For example, you can take advantage of the DriveInfo Class that provides access to information on a drive (e.g. free space available on each drive). Then, you can set the APPDIR with the related volume that has the most free space.

Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
liuyt1
Posts: 25
Joined: Sun Aug 02, 2015 10:18 pm

Re: how to detect biggest free disk

Dan,

Thanks for reply.
I try to avoid .net dependency.
So, do we support get this info from dos batch file to or AI call my private exe to get this info?

Thanks,
YT
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: how to detect biggest free disk

Hi,

In Advanced Installer you can run a CMD or BAT file through a Launch file predefined custom action. To launch an .EXE you can use the Launch attached file custom action. However, using an .EXE or an .BAT custom action you will not be able to set installer properties.

If you have other questions, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”