FIX: Zip - remove a partial archive on cancel (fixes #1260)

This commit is contained in:
Alexander Koblov 2026-02-14 15:13:03 +03:00
commit f2eb7513c8

View file

@ -389,6 +389,7 @@ end;
function PackFilesW(PackedFile: PWideChar; SubPath: PWideChar; SrcPath: PWideChar; AddList: PWideChar; Flags: Integer): Integer;dcpcall; export;
var
Exists: Boolean;
FileExt: String;
FilePath: String;
Arc : TAbZipKitEx;
@ -412,6 +413,7 @@ begin
sPackedFile := UTF16ToUTF8(UnicodeString(PackedFile));
try
Exists:= mbFileExists(sPackedFile);
FileExt:= LowerCase(ExtractFileExt(sPackedFile));
if ((Flags and PK_PACK_ENCRYPT) <> 0) then
@ -490,6 +492,10 @@ begin
Result := Arc.FOperationResult;
FreeAndNil(Arc);
end;
if (Result = E_EABORTED) and (not Exists) then
begin
mbDeleteFile(sPackedFile);
end;
end;
function DeleteFilesW(PackedFile, DeleteList : PWideChar) : Integer;dcpcall; export;