Robertopcn
Robertopcn

Reputation: 487

Check if drive is connected in Inno Setup

I need to know if a specific drive exists.

My application will install in two different drives, for example: drive F and G

[Setup]
DefaultDirName=F:\Test\

[Dirs]
Name: G:\Test\storage;

If drive F does not exists Inno Setup show a message about it. But if drive G does not exist the installer stops working.

Upvotes: 0

Views: 856

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202292

Use DirExists function:

function InitializeSetup(): Boolean;
begin
  while not DirExists('F:\') do
  begin
    MsgBox('Connect F:\ drive.', mbInformation, MB_OK); 
  end;
  Result := True;
end;

Upvotes: 2

Related Questions