[delphizip] Re: How to set/change comment for a single file?

  • From: Roger Aelbrecht <Roger.Aelbrecht@xxxxxxxxx>
  • To: delphizip@xxxxxxxxxxxxx
  • Date: Wed, 25 Feb 2009 15:31:21 +0100

Edwin Yip wrote:
> Hi Roger,
> I'm wrong that the Find method is not public, I make that guess upon reading
> the help.
> Anyway I looked its source and it returns a entry of of the DirEntry list,
> and I tried setting the DirEntry[0].Filecomment value but it seems that the
> comment is not saved back to the ZIP archive. any tips? thank you.
> 
> Best Regards,
> Edwin Yip
> 
> Mind Mapping is as Effortless as Typing
> http://www.InnovationGear.com
> 
> 
> On Wed, Feb 25, 2009 at 7:20 PM, Edwin Yip 
> <edwin.yip@xxxxxxxxxxxxxxxxxx>wrote:
> 
>> Hi Roger,
>> It seems that the Find method is not published in TZipMaster, of course
>> this is a tiny problem that can be solved by changing the source code, never
>> mind.
>>
>> My question is, can I set ZipDirEntry.FileComment to something and save it
>> back to the zip archive? Thank you.
>>
>>
>>
>> Best Regards,
>> Edwin Yip
>>
>> Mind Mapping is as Effortless as Typing
>> http://www.InnovationGear.com
>>
>>
>> On Tue, Feb 24, 2009 at 10:35 PM, Roger Aelbrecht <
>> Roger.Aelbrecht@xxxxxxxxx> wrote:
>>
>>> Edwin Yip wrote:
>>>> thank you very much Roger.
>>>> Implementing that in the event will cause the program logic to be
>>>> unreadable...
>>>>
>>>> Best Regards,
>>>> Edwin Yip
>>>>
>>>> Mind Mapping is as Effortless as Typing
>>>> http://www.InnovationGear.com
>>>>
>>>>
>>> I overlooked one other access possibility
>>>
>>> If you know the filename use the Find method that will return a
>>> ZipDirEntry pointer.
>>> Use idx := -1 for first search, idx will contain the index of the
>>> filename on return.
>>>
>>> function TCustomZipMaster.Find(const fspec: String;
>>>   var idx: Integer): pZipDirEntry;
>>>
>>> The ZipDirEntry points to a packed record that has a member
>>> FileComment: String;
>>>
>>> --
>>> Roger Aelbrecht
>>>
>>>
>>> -----------
>>> 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.
> 
> 
I am afraid the ZipDirEntry is read only.

In this version of ZipMaster the only way to change the file comment is 
using the OnFileComment event

If you specify the file you want to change in the FSpecArgs and execute 
Add() the event will be triggered for that file only and you can change 
the comment in the event handler.


-- 
Roger Aelbrecht


-----------
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: