简体   繁体   中英

InnoSetup: include and auto-install DirectX

I'm preparing a window installer for my nodewebkit application. It's an app that use Three.js, so DirectX is required.

How can I modify my installer.iss to install DirectX before (or after, isn't important) my app?

I have:

[Code]
function installDirectX() : Boolean;
begin
  ....
end;

[Run]
Filename "{app}\{#MyAppName}"; Description: "...."; Flags: nowait postinstall skipfsilent

more specifications

basically I want to include directx.exe in installer but I want also to launch directx.exe (only if NOT already installed -but this is a plus- )

update

As RobeN suggests I try:

[Files]
Source: "path\dxsetup.exe"; DestDir: "{app}"

[Run]
Filename: "dxsetup.exe"; WorkingDir: "{app}"; Parameters: "/silent"; Flags: waitilterminated  skipifdoesntexist; StatusMsg: "Installing Microsoft DirectX..."

But still doesn't work..

Solution 1:

This launch (always) DirectX installer after App installation.

[Files]
Source: "dxsetup.exe"; DestDir: "{app}"; AfterInstall: DirecXinstaller

[Code]
procedure DirecXinstaller;
var
  ResultCode: Integer;
begin
  if not Exec(ExpandConstant('{app}\dxsetup.exe'), '', '', SW_SHOWNORMAL,
    ewWaitUntilTerminated, ResultCode)
  then
    MsgBox('Other installer failed to run!' + #13#10 +
      SysErrorMessage(ResultCode), mbError, MB_OK);
end;

If via [Run] Section

[Files]
Source: "X:\YOUR_GAMEFILES\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs
Source: "d:\DirectX\*"; DestDir: "{tmp}"; Flags: nocompression createallsubdirs 
 recursesubdirs deleteafterinstall overwritereadonly ignoreversion uninsremovereadonly
;here you point to the folder with full DirectX intaller

[Run]
Filename: "{tmp}\DXSETUP.exe"; WorkingDir: "{tmp}"; Parameters: "/silent"; 
 Flags: waituntilterminated skipifdoesntexist; 
 StatusMsg: "Installing Microsoft DirectX..."
Filename: "{app}\YOURGAMEEXE.exe"; WorkingDir: "{app}"; 
 Flags: nowait postinstall runascurrentuser skipifsilent; Description: "Run MY GAME"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM