My installation concludes by informing the user that the file has been extracted, but when accessing the folder, there is no extracted file, it just opens the winrar screen displaying the contents of the file on the screen.
procedure CurStepChanged(CurStep: TSetupStep);
var
filename : string;
ErrorCode: Integer;
begin
filename := expandconstant('{tmp}\InstalaPlaylistClassic.zip');
MsgBox('O arquivo foi baixado com sucesso, estou em CurStepChanged: '+ filename + chr(13) , mbError, mb_Ok);
if CurStep=ssInstall then begin //Lets install those files that were downloaded for us
MsgBox('Verificando se o arquivo existe ', mbError, mb_Ok);
if fileExists(filename) then begin // foi baixado. Executar o instalador do fw.
MsgBox('O arquivo existe ' + filename + chr(13) + SysErrorMessage(ErrorCode), mbError, mb_Ok);
MsgBox('Chamando procedure unzip ', mbError, mb_Ok);
ExtractMe(ExpandConstant('{tmp}\InstalaPlaylistClassic.zip'),ExpandConstant('{userappdata}\ccc\extracted'));
if not ShellExec('', filename,'', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then begin
MsgBox('Houve algum problema ', mbError, mb_Ok);
// Xi! Deu erro
if ErrorCode <> 0 then begin
MsgBox('Erro ao executar o arquivo ' + filename + chr(13) + SysErrorMessage(ErrorCode), mbError, mb_Ok);
end
end
end
end
end;
const
SHCONTCH_NOPROGRESSBOX = 4;
SHCONTCH_RESPONDYESTOALL = 16;
procedure Unzip(ZipFile, TargetFolder: String);
var
ShellObj, SrcFile, DestFolder: Variant;
begin
ShellObj := CreateOleObject('Shell.Application');
SrcFile := ShellObj.NameSpace(ZipFile);
DestFolder := ShellObj.NameSpace(TargetFolder);
DestFolder.CopyHere(SrcFile.Items, SHCONTCH_NOPROGRESSBOX or SHCONTCH_RESPONDYESTOALL)
MsgBox('Arquivo extraído', mbError, mb_Ok);
end;
procedure ExtractMe(src, target : String);
begin
MsgBox('Entrei em ExtractMe, vou tentar extrair ', mbError, mb_Ok);
Unzip(ExpandConstant(src), ExpandConstant(target));
end;
In order for me to continue the process of installing my program, I need this file to be really extracted to the folder and I don't understand how to do that.
Thank you for any help