I'm trying to extract a file using 7zip in the [Codes]
section as I want to extract before any files get copied by the [Files]
section.
With the code below I am not getting it, I tried and changed it, but it appears that The system cannot find the specified file
Am I doing something wrong?
[Files]
// Copy 7za.exe to {tmp} folder
Source: "tools\7zip\7za.exe"; DestDir: "{tmp}\7zip"; Flags: deleteafterinstall;
Source: "{tmp}\launchers\Launcher1"; DestDir: "{app}"; Flags: onlyifdoesntexist external; BeforeInstall: ExtractLauncher
Source: "{tmp}\launchers\Launcher2"; DestDir: "{app}"; Flags: onlyifdoesntexist external; BeforeInstall: ExtractLauncher
// --------------------------- Extract Launcher --------------------------- \\
[Code]
var
ResultCode: integer;
procedure ExtractLauncher();
begin
Exec(ExpandConstant('{tmp}\7zip\7za.exe'), 'x "{tmp}\launchers\launcher.zip" -o"{tmp}\launchers" * -r -aoa', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
MsgBox(SysErrorMessage(ResultCode), mbError, MB_OK);
end;
The launcher.zip
file is downloaded during installation to the {tmp}\launchers
folder
I kept looking at the {tmp}
folder, and the launcher.zip
file and 7za.exe
are created before running my [Codes]
, I did this to make sure they were there when run the code.
And yes, they were there before running the code.