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
|
||||
*.app/
|
||||
|
||||
!tar.exe
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user