Delphi amp; Winrar. Como Descompactar?

Delphi

23/02/2005

Seguinte pessoal,

Eu já tenho um código para criar o arquivo.exe compactado pelo winrar no delphi, então a minha dúvida é a seguinte...

Comandos := ´a -sfxwincon.sfx -m5 -? ´´ + dir +´\´ + dm.MedCRM.asstring + ´´ ´ + ´´´ + ´´ + dir + ´\´ + ´Medico.gdb´ + ´´ + ´´´;

ShellExecute(0, nil, ´´WinRar.exe´´, PChar(Comandos), nil, Sw_Show);

A variavel ´dir´, é onde o arquivo Medico.gdb se encontra para poder compactá-lo e gerar o arquivo .exe (SFX), mas...

...muito bem, no código acima, nao sei onde colocar a pasta de destino para extração...

grato...

Alexandre Souza Paes


Alexpaes

Alexpaes

Curtidas 0

Respostas

Christian_adriano

Christian_adriano

23/02/2005

Olá Amigo,

Dá uma olhadinha na minha implementação, alguma duvida estou a disposição.



function DescompactarWinRar(DirOrigem, DirDestino, FileName : String) : String;
var
WinRar, sdir, stemp : String;
begin
try
Result := ´´;

sdir := ExtractFilePath(Application.ExeName);
stemp := ExtractShortPathName(sdir);
if stemp <> ´´ then
sdir := stemp;

stemp := ´´;
stemp := ExtractShortPathName(DirDestino);
if stemp <> ´´ then
DirDestino := stemp;

stemp := ´´;
stemp := ExtractShortPathName(DirOrigem);
if stemp <> ´´ then
DirOrigem := stemp + Filename
else
DirOrigem := DirOrigem + FileName;


WinRar := sdir + ´Winrar.exe x ´;
WinRar := WinRar + DirOrigem + ´ ´ + DirDestino;

WinExec(PChar(WinRar), SW_Show);

finally
Result := DirDestino + ´Temp\´ + Copy(FileName, 0, Length(FileName)- 4) + ´.Bkp´;
end;
end;


-----------------------------------------------------------------------------------

procedure CompactarWinRar(DirOrigem, DirDestino, FileName : String; Recriar : Boolean = false);
var
WinRar, sdir, stemp : String;
begin
try
sdir := ExtractFilePath(Application.ExeName);

stemp := ExtractShortPathName(DirDestino);
if stemp <> ´´ then
DirDestino := sTemp + FileName
else
DirDestino := DirDestino + FileName;

stemp := ExtractShortPathName(DirOrigem);
if stemp <> ´´ then
DirOrigem := sTemp + FileName
else
DirOrigem := DirOrigem + FileName;

sdir := ExtractShortPathName(sdir);
DirDestino := Copy(DirDestino, 0, Length(DirDestino)-4) + ´.rar´;

if FileExists(DirDestino) then
DeleteFile(PChar(DirDestino));

if (Recriar) then
WinRar := sdir + ´Winrar.exe a -vf -vd -s ´
else
WinRar := sdir + ´Winrar.exe a -vf -s ´;

WinRar := WinRar + DirDestino + ´ ´ + DirOrigem;

WinExec(PChar(WinRar), SW_Show);

finally
DeleteFile(PChar(DirOrigem));
end;

end;


[]´s.

Christian.


GOSTEI 0
Alexpaes

Alexpaes

23/02/2005

Cristian,

Este exemplo que vc mandou, funciona da maneira que estou fazendo. Criando um SFX Executável (Auto-Extraível). pois o problema que encontro é no momento que ele descompacta o arquivo, naum consigo adicionar no comando o diretório destino fixo.

tenho seu msn, mas naum vejo vc online.... gostaria de tratar este assunto por msn, se puder, entre em contato....

asp@iscc.com.br

AlexPaes


GOSTEI 0
POSTAR