Post by mycwcgr on Apr 10, 2004 3:51:57 GMT -5
Why is there differences between ExcludeList and FilesList about wildcard characters * and *.* in VCLZIP 3.04
I have done some test, I find the wildcard characters * and *.* is the same in FilesList, but there are not the same in ExcludeList!
This a sample, there are two files in c:\temp, One is "c:\temp\1.txt" and another is "c:\temp\2" which has no extension.
when I run the following program, I find that
1. No file is added to a.zip
2. "c:\temp\2" is added to b.zip !
3. "c:\temp\1.txt" and "c:\temp\2" is added to c.zip !
4. "c:\temp\1.txt" and "c:\temp\2" is added to d.zip !
Why?
//-------------------------------------------------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
VCLUnZip, VCLZip, StdCtrls;
type
TForm1 = class(TForm)
VCLZip1: TVCLZip;
Button2: TButton;
Button1: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
deletefile('C:\a.ZIP'); // must have the sentence
With VCLZip1 do begin
ZipName := 'C:\a.ZIP';
FilesList.Clear; // must have the sentence
ExcludeList.Clear; // must have the sentence
FilesList.Add('C:\temp\*');
ExcludeList.Add('C:\temp\*'); //It is only *
Zip;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
deletefile('C:\b.ZIP'); // must have the sentence
With VCLZip1 do begin
ZipName := 'C:\b.ZIP';
FilesList.Clear; // must have the sentence
ExcludeList.Clear; // must have the sentence
FilesList.Add('C:\temp\*');
ExcludeList.Add('C:\temp\*.*'); //It is *.*
Zip;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
deletefile('C:\c.ZIP'); // must have the sentence
With VCLZip1 do begin
ZipName := 'C:\c.ZIP';
FilesList.Clear; // must have the sentence
ExcludeList.Clear; // must have the sentence
FilesList.Add('C:\temp\*'); //It is only *
Zip;
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
deletefile('C:\d.ZIP'); // must have the sentence
With VCLZip1 do begin
ZipName := 'C:\d.ZIP';
FilesList.Clear; // must have the sentence
ExcludeList.Clear; // must have the sentence
FilesList.Add('C:\temp\*.*'); //It is *.*
Zip;
end;
end;
end.
I have done some test, I find the wildcard characters * and *.* is the same in FilesList, but there are not the same in ExcludeList!
This a sample, there are two files in c:\temp, One is "c:\temp\1.txt" and another is "c:\temp\2" which has no extension.
when I run the following program, I find that
1. No file is added to a.zip
2. "c:\temp\2" is added to b.zip !
3. "c:\temp\1.txt" and "c:\temp\2" is added to c.zip !
4. "c:\temp\1.txt" and "c:\temp\2" is added to d.zip !
Why?
//-------------------------------------------------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
VCLUnZip, VCLZip, StdCtrls;
type
TForm1 = class(TForm)
VCLZip1: TVCLZip;
Button2: TButton;
Button1: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
deletefile('C:\a.ZIP'); // must have the sentence
With VCLZip1 do begin
ZipName := 'C:\a.ZIP';
FilesList.Clear; // must have the sentence
ExcludeList.Clear; // must have the sentence
FilesList.Add('C:\temp\*');
ExcludeList.Add('C:\temp\*'); //It is only *
Zip;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
deletefile('C:\b.ZIP'); // must have the sentence
With VCLZip1 do begin
ZipName := 'C:\b.ZIP';
FilesList.Clear; // must have the sentence
ExcludeList.Clear; // must have the sentence
FilesList.Add('C:\temp\*');
ExcludeList.Add('C:\temp\*.*'); //It is *.*
Zip;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
deletefile('C:\c.ZIP'); // must have the sentence
With VCLZip1 do begin
ZipName := 'C:\c.ZIP';
FilesList.Clear; // must have the sentence
ExcludeList.Clear; // must have the sentence
FilesList.Add('C:\temp\*'); //It is only *
Zip;
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
deletefile('C:\d.ZIP'); // must have the sentence
With VCLZip1 do begin
ZipName := 'C:\d.ZIP';
FilesList.Clear; // must have the sentence
ExcludeList.Clear; // must have the sentence
FilesList.Add('C:\temp\*.*'); //It is *.*
Zip;
end;
end;
end.