[delphizip] Re: OnSetAddName - remove file from the list

  • From: "R. Peters" <russellpeters@xxxxxxxxxxx>
  • To: <delphizip@xxxxxxxxxxxxx>
  • Date: Sun, 16 Jan 2005 06:22:05 +1100

To do what you want the dll would need to check for duplicate names before
adding them to some internal lists and this is too slow (much quicker to
sort all names once or use entirely different lists or maybe sorted trees
instead).
The stored name for the file is constructed (and changed via event) before
sorting and duplicate removal but cannot know what is already in the list.
It would take a complete rewrite to do it the way I would prefer (and would
do what you want), that is, give an opportunity to rename if there is a
duplicate (then which needs to be renamed the new entry or the existing, and
possibly older, one).
This is also complicated by there possibly being files already in archive
being added to.
I am still working at finding ways to do it without slowing things.

Stopping files being added by setting it's name to an empty string also
seemed a good idea but caused problems which made it impractical but maybe
not insurmountable - I will check (did not try too hard because, at the
time, it was an idea that might have been useful).
- Russell Peters
-----Original Message-----
From: delphizip-bounce@xxxxxxxxxxxxx [mailto:delphizip-bounce@xxxxxxxxxxxxx]
On Behalf Of Kiri Levente
Sent: Saturday, 15 January 2005 7:42 AM
To: delphizip@xxxxxxxxxxxxx
Subject: [delphizip] Re: OnSetAddName - remove file from the list

The idea is to use this event (or any ZipMaster event) to set the path and 
name of the files in the zip archive. I mean in my project the zipped files 
have completelly different path than the original disk paths, so i need a 
possibility to rename the files or even disable some of them.
I found this event usefull because i have the ExtName parameter. In my case 
the option AddDirNames is not important at all because I simply ignore the 
FileName parameter and I rename the file.
I've used ZipMaster 1.78

1. My First Solution: I've tried without AddDirnames. This is working 
because anyway i set the path, using the information from ExtName. It is 
also possible to set nothing to filename and the file is not added at all. 
Maybe it's a bug (very usefull in my case).

What I found not very logic : i cannot add files with the same filename, 
even if i rename them.
Probably you check the Filenames, why you don't check the renamed files to 
see if you have duplicate filenames ?

Ex:

 C:\My Files\duplicate.txt                         -> 
MyStorageFolder\duplicate.txt
 C:\My Files\Folder\duplicate.txt              -> 
MyStorageFolder2\duplicate.txt
 C:\My Files\Folder\todelete.txt               -> (nothing)

-empty allowed
-duplicate is not possible, because of duplicate filename.

2. My Second Solution: with AddDirnames

Ex.

 C:\My Files\duplicate.txt                         -> 
MyStorageFolder\duplicate.txt
 C:\My Files\Folder\duplicate.txt              -> 
MyStorageFolder2\duplicate.txt
 C:\My Files\Folder\todelete.txt                -> (nothing)

- empty not allowed (Bad Zip Options)
-duplicate is possible

-------------

Question: is there any possibilty to solve this problem ? An event to rename

the files and to cancel some.

KL


----- Original Message ----- 
From: "Roger Aelbrecht" <Aelbrecr@xxxxxxxxxx>
To: <delphizip@xxxxxxxxxxxxx>
Sent: Friday, January 14, 2005 8:11 PM
Subject: [delphizip] Re: OnSetAddName - remove file from the list


> Kiri Levente wrote:
>> HI!
>>
>> How is possible to cancel, remove the file in this event ?
>>
>> procedure TBackupThread.ZipMasterOnSetAddName(Sender: TObject; var
>> FileName: String; const ExtName: String; var IsChanged: Boolean);
>>
>> 1. If I NOT set AddDirnames, it is possible to set IsChanged to true,
>> and FileName to nothing, it works
>>
>> Problem with this solution: I cannot add files with the same name
>> even if they are in different folders, and I rename them (by adding
>> path too), (Bad Zip Options specified)
>>
>> 2. If I use AddDirnames, then I cannot set nothing, empty string for
>> FileName (Bad Zip Options specified).
>>
>>
>> The main question is: how can I cancel a file in this event ?
>>
>> The second question is : why I cannot set empty string if AddDirnames
>> is set, or why without AddDirnames ZipMaster says duplicate filename
>> even after renaming the file ?
>>
>> Thanks.
>>
>> -----------
>> To unsubscribe from this list, send an empty e-mail
>> message to:
>>   delphizip-request@xxxxxxxxxxxxx
>> and put the word unsubscribe in the subject.
>
> You cannot cancel a file in this event, it is only intended to change the
> file
> name during the Add operation/
> If you set IsChanged to true and nothing to filename you are adding a file
> with an empty filename(noname) to the archive. In future version we intend
> to test legality of the filename and this would surely be illegal.
>
> IF you have AddDirNames not specified then the path is stripped of
> and you cannot add the same file twice.
> Because the path is stripped off it does not matter that they are in
> different directories, the directory name is removed.
>
> I would have to go into the dll to see why you cannot specify an empty 
> file
> with AddDirNames set. I expect a dir name is needed in this case.
> The duplicate filename question I explained above
>
>
>
> -- 
> Roger Aelbrecht
> http://home.tiscali.be/driehoeksw
>
>
>
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.6.11 - Release Date: 12/01/2005
>
> -----------
> To unsubscribe from this list, send an empty e-mail
> message to:
>  delphizip-request@xxxxxxxxxxxxx
> and put the word unsubscribe in the subject.
> 

-----------
To unsubscribe from this list, send an empty e-mail 
message to:
  delphizip-request@xxxxxxxxxxxxx 
and put the word unsubscribe in the subject.

-----------
To unsubscribe from this list, send an empty e-mail 
message to:
  delphizip-request@xxxxxxxxxxxxx 
and put the word unsubscribe in the subject.

Other related posts: