sorry for my english.
Hi my installer will download files , by the addition of " IDP : Download plugin for Inno Setup," and I have a problem because they are downloaded in .zip format so need to be extracted , whether it is possible to be unpacked where the application ? It is an add-on or something? Please help.
You can ship the unzip tool of your choice and use it for extraction.
I tend to ship "7za" (the command-line version of 7zip), because i found out that it's extraction speed is really good (and better than unzip).
Firstly, you integrate the extraction tool into your installer.
[Files]
Source: ..\utils\unzip\7za.exe; DestDir: {tmp}; Flags: dontcopy
Source: and some zip files ...
Note the dontcopy
. This will not copy the file to the user system during the normal file copying stage, but statically compile the file into the installation.
Secondly, you might add a little DoUnzip
helper method to your [Code]
section.
It will use the tool from the temp folder.
procedure DoUnzip(source: String; targetdir: String);
var
unzipTool: String;
ReturnCode: Integer;
begin
// source contains tmp constant, so resolve it to path name
source := ExpandConstant(source);
unzipTool := ExpandConstant('{tmp}\7za.exe');
if not FileExists(unzipTool)
then MsgBox('UnzipTool not found: ' + unzipTool, mbError, MB_OK)
else if not FileExists(source)
then MsgBox('File was not found while trying to unzip: ' + source, mbError, MB_OK)
else begin
if Exec(unzipTool, ' x "' + source + '" -o"' + targetdir + '" -y',
'', SW_HIDE, ewWaitUntilTerminated, ReturnCode) = false
then begin
MsgBox('Unzip failed:' + source, mbError, MB_OK)
end;
end;
end;
Thirdly, you extract the unzip tool, then the zips and then you simply use the DoUnzip() method on the zips. These commands are for the [Code]
section.
// extract 7za to temp folder
ExtractTemporaryFile('7za.exe');
// extract the zip to the temp folder (when included in the installer)
// skip this, when the file is downloaded with IDP to the temp folder
//ExtractTempraryFile('app.zip);
targetPath := ExpandConstant('{tmp}\');
// unzip the zip in the tempfolder to your application target path
DoUnzip(targetPath + 'app.zip', ExpandConstant('{app}'));