ExistsDir Example

InstallShield 2014 ยป InstallScript Language Reference

Note: To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

/*--------------------------------------------------------------*\

*

* InstallShield Example Script

*

* Demonstrates the ExistsDir function.

*

* AskPath is called to get a directory name from the user.

* Then, ExistsDir is called to determine whether the directory

* exists.

*

\*--------------------------------------------------------------*/

 

#define TITLE_TEXT "ExistsDir Example"

 

// Include Ifx.h for built-in InstallScript function prototypes.

#include "Ifx.h"

 

export prototype ExFn_ExistsDir(HWND);

 

function ExFn_ExistsDir(hMSI)

    STRING svPath;

begin

 

    // Get the path to be created.

    AskPath ("Please enter a path:", "", svPath);

    

    // Check for the existence of the directory.

    if (ExistsDir (svPath) = EXISTS) then

        SprintfBox (INFORMATION, TITLE_TEXT, "%s already exists.", svPath);

    else

        SprintfBox (INFORMATION, TITLE_TEXT, "%s does not exist", svPath);

    endif;

 

end;