For unzipping a certain file I use the following program:
{$mode objfpc}{$H+}
uses classes,sysutils,zipper;
function unzip_file(fspecZ,fspecP,destDir: ansistring): ansistring;
{unzips packed file 'fspecP' from zipfile 'fspecZ' to destination 'destDir'}
var Z: TUnZipper;
SL: TStringList;
begin
Z:=TUnZipper.Create;
SL:=TStringList.Create;
try
SL.Add(fspecP);
Z.FileName:=fspecZ;
Z.OutputPath:=destDir;
Z.UnZipFiles(SL);
Z.Free;
SL.Free;
exit(''); {if no Error}
except
on E: EZipError do
begin
Z.Free; SL.Free; exit('Error 1 ' + E.Message);
end;
on E: Exception do {all other Exceptions: }
begin
Z.Free; SL.Free; exit('Error 2 ' + E.Message);
end;
end;
end;
var fspecZ,fspecP,destDir,se: ansistring;
begin
fspecZ:='h:\tmp\Dylan.zip';
fspecP:='Dylan.wav'; // this file is 147 MB big
destDir:='d:\Tst\unzip\'; // this drive has only 137 MB free
se:=unzip_file(fspecZ,fspecP,destDir);
writeln('result="', se, '"');
end.
But when I unzip a file, which is bigger than the free space on the destination harddisk, I get no error. The file is just truncated. I would expect to get an error, because the file is invalid.
Do I something wrong?
Is this a bug?
I use FPC 3.0.4 on Windows 7. My little project is attached. Thanks in advance.