summaryrefslogtreecommitdiff
path: root/UCoreWorkers.pas
diff options
context:
space:
mode:
Diffstat (limited to 'UCoreWorkers.pas')
-rw-r--r--UCoreWorkers.pas49
1 files changed, 24 insertions, 25 deletions
diff --git a/UCoreWorkers.pas b/UCoreWorkers.pas
index 2b5c4d5..cf0fc13 100644
--- a/UCoreWorkers.pas
+++ b/UCoreWorkers.pas
@@ -531,29 +531,25 @@ end;
procedure TWorkerThread.PrepareJobFilesFromPanel(AList: TList; DoNotRecurse: boolean);
var i: longint;
CurrPath: string;
- x: PDataItemSL;
+ InputFiles: TStringList;
begin
+ InputFiles := TStringList.Create;
CurrPath := IncludeTrailingPathDelimiter(Engine.Path);
+ // Process selected files first
if DataList.Count > 0 then
for i := 0 to DataList.Count - 1 do
with PDataItem(DataList[i])^ do
if (not UpDir) and Selected then
- if IsDir and (not IsLnk) and (not DoNotRecurse)
- then FillDirFiles(Engine, AList, CurrPath + String(FName))
- else begin
- x := GetFileInfoSL(Engine, CurrPath + String(FName));
- if x <> nil then AList.Add(x);
- end;
+ InputFiles.Add(CurrPath + String(FName));
+ // If not files are selected, take into the account current active item
if (AList.Count = 0) and Assigned(SelectedItem) and (not SelectedItem^.UpDir) then
- with SelectedItem^ do
- if IsDir and (not IsLnk) and (not DoNotRecurse)
- then FillDirFiles(Engine, AList, CurrPath + String(FName))
- else begin
- x := GetFileInfoSL(Engine, CurrPath + String(FName));
- if x <> nil then AList.Add(x);
- end;
+ InputFiles.Add(CurrPath + String(SelectedItem^.FName));
+
+ FillDirFiles(Engine, AList, InputFiles, DoNotRecurse);
+ InputFiles.Free;
end;
+
(********************************************************************************************************************************)
(********************************************************************************************************************************)
procedure ProcessProgressThread(SenderThread: TWorkerThread; ProgressForm: TFProgress);
@@ -767,7 +763,6 @@ var i: longint;
begin
SkipAll := False;
AList := TList.Create;
- AList.Clear;
with SenderThread do begin
CurrPath := IncludeTrailingPathDelimiter(Engine.Path);
PrepareJobFilesFromPanel(AList, False);
@@ -1274,19 +1269,19 @@ var DefResponse: integer; // Global variables for this function
end;
end;
+ // Can be called only once, otherwise sorting will fail and extract errors may appear
+ // TODO: make this universal
+ // TODO: this is complete mess, make it more clear
procedure HandleProcessPattern(AList: TList; CurrPath, FullPath, ParamFileName: string; ParamDir, Ren: boolean);
var s, s2: string;
b, CaseInsensitiveRename: boolean;
Info: PDataItemSL;
+ InputFiles: TStringList;
begin
- with SenderThread do
+ InputFiles := TStringList.Create;
+ with SenderThread do begin
if not Ren then begin
- if ParamDir then FillDirFiles(SrcEngine, AList, FullPath)
- else begin
- Info := GetFileInfoSL(SrcEngine, FullPath);
- if Info = nil then DebugMsg(['$$$ Copy: Something went wrong while building the filelist...'])
- else AList.Add(Info);
- end;
+ InputFiles.Add(FullPath);
end else begin
s := ProcessPattern(DestEngine, ParamString1, CurrPath, ParamFileName, ParamDir);
CaseInsensitiveRename := (WideCompareStr(ParamString1, ParamFileName) <> 0) and (WideCompareText(ParamString1, ParamFileName) = 0) and
@@ -1312,8 +1307,11 @@ var DefResponse: integer; // Global variables for this function
Info^.ForceMove := True;
AList.Add(Info);
end;
- end else FillDirFiles(SrcEngine, AList, FullPath);
+ end else InputFiles.Add(FullPath);
end;
+ FillDirFiles(SrcEngine, AList, InputFiles, False);
+ end;
+ InputFiles.Free;
end;
var i: longint;
@@ -1333,6 +1331,7 @@ begin
ParamString1 := ExcludeTrailingPathDelimiter(ParamString1);
if ParamString1 = '' then ParamString1 := PathDelim;
+ // Prepare list of files to copy
if ParamBool5 then begin // HandleVFSFromArchive
if not ExtractFromVFSAll then HandleProcessPattern(List, CurrPath, ParamString2, ExtractFileName(ParamString2), False, False)
else begin
@@ -1908,8 +1907,8 @@ var i: longint;
Fr: Single;
begin
SkipAll := False;
+ AList := TList.Create;
with SenderThread do begin
- AList := TList.Create;
PrepareJobFilesFromPanel(AList, not ParamBool1);
libc_chdir('/');
SetProgress1Params(AList.Count);
@@ -1986,8 +1985,8 @@ var i: longint;
Fr: Single;
begin
SkipAll := False;
+ AList := TList.Create;
with SenderThread do begin
- AList := TList.Create;
PrepareJobFilesFromPanel(AList, not ParamBool1);
libc_chdir('/');
SetProgress1Params(AList.Count);