mirror of
https://github.com/moparisthebest/Simba
synced 2025-02-07 10:40:19 -05:00
Fixed unwanted Segfault + small update in UntarEx
This commit is contained in:
parent
9c76c1a191
commit
b7ac0e8dec
@ -106,7 +106,9 @@ end;
|
|||||||
function UnTar(const Input: TStream; const outputdir: string; overwrite: boolean): boolean; overload;
|
function UnTar(const Input: TStream; const outputdir: string; overwrite: boolean): boolean; overload;
|
||||||
var
|
var
|
||||||
Tar : TTarArchive;
|
Tar : TTarArchive;
|
||||||
|
Succ : boolean;
|
||||||
DirRec : TTarDirRec;
|
DirRec : TTarDirRec;
|
||||||
|
FS : TFileStream;
|
||||||
begin;
|
begin;
|
||||||
result := false;
|
result := false;
|
||||||
if not DirectoryExists(outputdir) then
|
if not DirectoryExists(outputdir) then
|
||||||
@ -114,23 +116,33 @@ begin;
|
|||||||
exit;
|
exit;
|
||||||
Tar := TTarArchive.Create(input);
|
Tar := TTarArchive.Create(input);
|
||||||
Tar.reset;
|
Tar.reset;
|
||||||
|
Succ := True;
|
||||||
while Tar.FindNext(DirRec) do
|
while Tar.FindNext(DirRec) do
|
||||||
begin
|
begin
|
||||||
if (DirRec.FileType = ftDirectory) then
|
if (DirRec.FileType = ftDirectory) then
|
||||||
begin;
|
begin;
|
||||||
if not DirectoryExists(outputdir + DirRec.Name) and not CreateDir(outputdir + DirRec.Name) then
|
if not DirectoryExists(outputdir + DirRec.Name) and not CreateDir(outputdir + DirRec.Name) then
|
||||||
exit
|
begin
|
||||||
|
Succ := false;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
end else if (DirRec.FileType = ftNormal) then
|
end else if (DirRec.FileType = ftNormal) then
|
||||||
begin;
|
begin;
|
||||||
if FileExists(outputdir + dirrec.name) and not overwrite then
|
if FileExists(outputdir + dirrec.name) and not overwrite then
|
||||||
continue;
|
continue;
|
||||||
Tar.ReadFile(outputdir + dirrec.name);
|
try
|
||||||
|
FS := TFileStream.Create(outputdir +dirrec.name,fmCreate);
|
||||||
|
tar.ReadFile(fs);
|
||||||
|
FS.Free;
|
||||||
|
except
|
||||||
|
Succ := false;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
mDebugLn(format('Unknown filetype in archive. %s',[dirrec.name]));
|
mDebugLn(format('Unknown filetype in archive. %s',[dirrec.name]));
|
||||||
end;
|
end;
|
||||||
Tar.Free;
|
Tar.Free;
|
||||||
Result := true;
|
Result := Succ;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TProcThread.Create;
|
constructor TProcThread.Create;
|
||||||
|
@ -134,7 +134,7 @@ begin
|
|||||||
|
|
||||||
for i := l - 1 downto 0 do
|
for i := l - 1 downto 0 do
|
||||||
begin
|
begin
|
||||||
if (IncludeBuffer[i].CodeInsight.FileName = FileName) then
|
if (IncludeBuffer[i].CodeInsight <> nil) and (IncludeBuffer[i].CodeInsight.FileName = FileName) then
|
||||||
begin
|
begin
|
||||||
DefineMatch := (IncludeBuffer[i].DefinesIn.Defines = Defines.Defines) and (IncludeBuffer[i].DefinesIn.Stack = Defines.Stack);
|
DefineMatch := (IncludeBuffer[i].DefinesIn.Defines = Defines.Defines) and (IncludeBuffer[i].DefinesIn.Stack = Defines.Stack);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user