Use libtar instead of tar.exe (closes #1)
This commit is contained in:
parent
41e8cb2daf
commit
da5edbeef4
2
.gitignore
vendored
2
.gitignore
vendored
@ -28,5 +28,3 @@ lib/
|
|||||||
|
|
||||||
# Application bundle for Mac OS
|
# Application bundle for Mac OS
|
||||||
*.app/
|
*.app/
|
||||||
|
|
||||||
!tar.exe
|
|
@ -1,6 +1,6 @@
|
|||||||
program downloader;
|
program downloader;
|
||||||
|
|
||||||
uses fphttpclient, base64, opensslsockets, fpjson, jsonparser, SysUtils, process, Classes;
|
uses fphttpclient, base64, opensslsockets, fpjson, jsonparser, SysUtils, process, Classes, libtar;
|
||||||
|
|
||||||
const
|
const
|
||||||
authString = '***REMOVED***';
|
authString = '***REMOVED***';
|
||||||
@ -50,11 +50,17 @@ end;
|
|||||||
|
|
||||||
procedure extractTar(fileName: String);
|
procedure extractTar(fileName: String);
|
||||||
var
|
var
|
||||||
s: AnsiString;
|
tarFile: TTarArchive;
|
||||||
|
tarContent: TTarDirRec;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
writeln('start extract tar');
|
writeln('start extract tar');
|
||||||
RunCommand('tar.exe', ['-xf', fileName], s);
|
tarFile := TTarArchive.Create(fileName);
|
||||||
|
while tarFile.FindNext(tarContent) do
|
||||||
|
begin
|
||||||
|
tarFile.ReadFile(tarContent.Name);
|
||||||
|
end;
|
||||||
|
tarFile.Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure copyFile(oldFile, newFile: AnsiString);
|
procedure copyFile(oldFile, newFile: AnsiString);
|
||||||
@ -122,6 +128,7 @@ begin
|
|||||||
tarFile := downloadGameTar(client, gameId);
|
tarFile := downloadGameTar(client, gameId);
|
||||||
extractTar(tarFile);
|
extractTar(tarFile);
|
||||||
proccessHashFiles;
|
proccessHashFiles;
|
||||||
|
DeleteFile(tarFile);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -132,5 +139,6 @@ begin
|
|||||||
begin
|
begin
|
||||||
WriteLn('No game id was given');
|
WriteLn('No game id was given');
|
||||||
end;
|
end;
|
||||||
|
readln;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user