FIX: the issue that SourceFiles was not deleted when tar processed by Wcx in uWcxArchiveCopyInOperation

This commit is contained in:
rich2014 2026-06-24 19:28:08 +08:00
commit e86116d34a

View file

@ -43,7 +43,7 @@ type
function doTarFiles(const files: TFiles): Integer;
protected
function Tar: Boolean;
function Tar(var success: Boolean): Boolean;
procedure SetProcessDataProc(hArcData: TArcHandle);
procedure DoReloadFileSources; override;
@ -317,6 +317,7 @@ procedure TWcxArchiveCopyInOperation.MainExecute;
var
removeFiles: TFiles = nil;
success: Boolean;
begin
// 1. calc statistics
FillAndCount( SourceFiles,
@ -340,8 +341,8 @@ begin
if (PackingFlags and PK_PACK_MOVE_FILES) <> 0 then
removeFiles:= SourceFiles.Clone;
// Result = True means that Tar is processed by WCX
if self.Tar() then
success:= False;
if self.Tar(success) then // Result = True means that TarAndZip is processed by WCX or fail
Exit;
// .tar created, don't need PK_PACK_MOVE_FILES anymore in Wcx
@ -349,15 +350,13 @@ begin
PackingFlags:= PackingFlags - PK_PACK_MOVE_FILES;
end;
if NOT doPack() then
Exit;
// if success, delete files need to be removed
if Assigned(removeFiles) then
DeleteFiles(removeFiles);
success:= False;
success:= doPack;
finally
FreeAndNil(FFullFilesTree);
if success and Assigned(removeFiles) then
DeleteFiles(removeFiles);
removeFiles.Free;
FreeAndNil(FFullFilesTree);
// Delete temporary TAR archive if needed
if FTarFileName <> EmptyStr then
mbDeleteFile(FTarFileName);
@ -634,7 +633,8 @@ begin
end;
end;
function TWcxArchiveCopyInOperation.Tar: Boolean;
// Result = True means that TarAndZip is processed by WCX or fail
function TWcxArchiveCopyInOperation.Tar(var success: Boolean): Boolean;
function tarFiles: Boolean;
var
@ -681,7 +681,8 @@ begin
end;
try
if TarFiles() then begin
success:= TarFiles();
if success then begin
if Result = False then begin
// Result = False means that Tar is processed internally
// Fill file list with tar archive file