File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ TarchiveStream = class(Tstream)
99
99
constructor create;
100
100
destructor Destroy; override;
101
101
function addFile (src:string; dst:string=' ' ; data:Tobject=NIL ):boolean; virtual ;
102
+ function contains (src:string):boolean;
102
103
function count ():integer;
103
104
procedure reset (); virtual ;
104
105
property totalSize:int64 read getTotal;
@@ -524,6 +525,16 @@ function TarchiveStream.getTotal():int64;
524
525
result:=cachedTotal;
525
526
end ; // getTotal
526
527
528
+ function TarchiveStream.contains (src:string):boolean;
529
+ var
530
+ i: integer;
531
+ begin
532
+ for i:=0 to Length(flist)-1 do
533
+ if flist[i].src = src then
534
+ exit(TRUE);
535
+ result:=FALSE;
536
+ end ;
537
+
527
538
function TarchiveStream.addFile (src:string; dst:string=' ' ; data:Tobject=NIL ):boolean;
528
539
529
540
function getMtime (fh:Thandle):int64;
Original file line number Diff line number Diff line change @@ -5024,6 +5024,14 @@ procedure Tmainfrm.httpEvent(event:ThttpEvent; conn:ThttpConn);
5024
5024
tar: TtarStream;
5025
5025
nofolders, selection, itsAsearch: boolean;
5026
5026
5027
+ procedure addToTar (src,dst:string);
5028
+ var
5029
+ i: integer;
5030
+ begin
5031
+ if not selection or not tar.contains(src) then
5032
+ tar.addFile(src, dst);
5033
+ end ;
5034
+
5027
5035
procedure addFolder (f:Tfile; ignoreConnFilters:boolean=FALSE);
5028
5036
var
5029
5037
i, ofs: integer;
@@ -5058,7 +5066,7 @@ procedure Tmainfrm.httpEvent(event:ThttpEvent; conn:ThttpConn);
5058
5066
else
5059
5067
s:=fi.pathTill(f.parent); // we want the path to include also f, so stop at f.parent
5060
5068
5061
- tar.addFile (fi.resource, s);
5069
+ addToTar (fi.resource, s);
5062
5070
end
5063
5071
finally listing.free end ;
5064
5072
end ; // addFolder
@@ -5093,7 +5101,7 @@ procedure Tmainfrm.httpEvent(event:ThttpEvent; conn:ThttpConn);
5093
5101
t:=substr(s, lastDelimiter(' \/' , s)+1 )
5094
5102
else
5095
5103
t:=s;
5096
- tar.addFile (ft.resource, t);
5104
+ addToTar (ft.resource, t);
5097
5105
finally freeIfTemp(ft) end ;
5098
5106
end ;
5099
5107
end ; // addSelection
You can’t perform that action at this time.
0 commit comments