diff --git a/.gitignore b/.gitignore index d06df06..b32943f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,5 +28,3 @@ lib/ # Application bundle for Mac OS *.app/ - -!tar.exe \ No newline at end of file diff --git a/downloader.pas b/downloader.pas index 19c39c9..d5c373f 100644 --- a/downloader.pas +++ b/downloader.pas @@ -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. diff --git a/tar.exe b/tar.exe deleted file mode 100644 index d528bd3..0000000 Binary files a/tar.exe and /dev/null differ