Use libtar instead of tar.exe (closes #1)

This commit is contained in:
Matthew Welch 2021-02-04 15:30:29 -08:00
parent 41e8cb2daf
commit da5edbeef4
3 changed files with 11 additions and 5 deletions

2
.gitignore vendored
View File

@ -28,5 +28,3 @@ lib/
# Application bundle for Mac OS # Application bundle for Mac OS
*.app/ *.app/
!tar.exe

View File

@ -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.

BIN
tar.exe

Binary file not shown.