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
*.app/
!tar.exe

View File

@ -1,6 +1,6 @@
program downloader;
uses fphttpclient, base64, opensslsockets, fpjson, jsonparser, SysUtils, process, Classes;
uses fphttpclient, base64, opensslsockets, fpjson, jsonparser, SysUtils, process, Classes, libtar;
const
authString = '***REMOVED***';
@ -50,11 +50,17 @@ end;
procedure extractTar(fileName: String);
var
s: AnsiString;
tarFile: TTarArchive;
tarContent: TTarDirRec;
begin
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;
procedure copyFile(oldFile, newFile: AnsiString);
@ -122,6 +128,7 @@ begin
tarFile := downloadGameTar(client, gameId);
extractTar(tarFile);
proccessHashFiles;
DeleteFile(tarFile);
end
else
begin
@ -132,5 +139,6 @@ begin
begin
WriteLn('No game id was given');
end;
readln;
end.

BIN
tar.exe

Binary file not shown.