在 Inno Setup 中检查驱动器是否已连接

Check if drive is connected in Inno Setup

我需要知道特定驱动器是否存在。

我的应用程序将安装在两个不同的驱动器中,例如:驱动器 F 和 G

[Setup]
DefaultDirName=F:\Test\

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

如果驱动器 F 不存在,Inno Setup 会显示一条关于它的消息。但如果驱动器 G 不存在,安装程序将停止工作。

使用DirExists函数:

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