Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Files]
- Source: "7za.exe"; Flags: dontcopy
- [Code]
- const
- ERROR_7_ZIP_NO_ERROR = 0;
- ERROR_7_ZIP_WARNING = 1;
- ERROR_7_ZIP_FATAL_ERROR = 2;
- ERROR_7_ZIP_CMD_LINE_ERROR = 7;
- ERROR_7_ZIP_NOT_ENOUGH_MEMORY = 8;
- ERROR_7_ZIP_USER_ABORT = 255;
- procedure CurStepChanged(CurStep: TSetupStep);
- var
- ResultCode: Integer;
- begin
- if CurStep = ssPostInstall then
- begin
- if idpFilesDownloaded then
- begin
- // extract the archiver tool into the temporary folder
- ExtractTemporaryFile('7za.exe');
- // and execute it
- if Exec(ExpandConstant('{tmp}\7za.exe'), ExpandConstant('x {app}\File.zip -o{app}\Extracted\'),
- '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
- begin
- // the execution of the tool succeeded, but it doesn't mean that
- // extraction was successful; now we need to determine what exit
- // code the tool returned (for more information follow this link
- // http://sevenzip.sourceforge.jp/chm/cmdline/exit_codes.htm)
- case ResultCode of
- ERROR_7_ZIP_NO_ERROR: ; // all the files were successfully extracted
- ERROR_7_ZIP_WARNING: ; // you can react somehow on the rest of the errors somehow
- ERROR_7_ZIP_FATAL_ERROR: ;
- ERROR_7_ZIP_CMD_LINE_ERROR: ;
- ERROR_7_ZIP_NOT_ENOUGH_MEMORY: ;
- ERROR_7_ZIP_USER_ABORT: ;
- end;
- end
- else
- begin
- // the execution of the archiver tool failed; from SysErrorMessage(ResultCode)
- // you can get the reason of the failure
- end;
- end;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement