ares
New Member
Posts: 12
|
Post by ares on Oct 15, 2008 5:26:06 GMT -5
Hi!
When trying to zip files which are currently in use and thus blocked (e.g. open World files) VCLZip does not show any error. It seems that the files are correctly zipped but this is not the case. The files are stored with a size of 0 Bytes in the zip file which is, of course, not correct...
Is there any possibility to catch this sort of error in order to show a hint to the user?
Ares
|
|
|
Post by Kevin on Oct 15, 2008 14:27:45 GMT -5
See FileOpenMode property in the help file. The default is to allow VCLZip to zip open files. If this is not what you want then set the FileOpenMode as it is described in the help file and be sure to create an OnSkippingFile event so you'll know when and which files are skipped because they are open. OnSkippingFile will also give you a chance to retry incase there is a way for you to close the file.
Kevin
|
|
ares
New Member
Posts: 12
|
Post by ares on Oct 22, 2008 5:11:14 GMT -5
Hi Kevin,
I have changed the FileOpenMode as follows: MyZipper.FileOpenMode := (fmOpenRead or fmShareDenyNone).
This should be the default value, should it not?
Anyway OnSkippingFile is not called. The files are stored with a size of 0 bytes in the zip file and I do not get any error message or something.
Any idea?
|
|
|
Post by Kevin on Oct 22, 2008 17:14:45 GMT -5
The default value is (fmOpenRead or fmShareDenyNone). This setting will allow VCLZip to backup files that are opened by other applications.
If you want to be sure that VCLZip only backs up files if they are not opened by any other process at all. In this case you would set this property as
FileOpenMode := fmOpenRead or fmShareExclusive;
I had the default set to this for one version long ago but people complained that they preferred to have the default be to back up files even if they are open so I set it back.
Kevin
|
|
ares
New Member
Posts: 12
|
Post by ares on Oct 23, 2008 8:00:04 GMT -5
Sorry, but this was not a answer to my question It would be great if VCLZip would zip open files but it does not. From my point of you VCLZip should act as follows: 1. Try to open file for read even if they are already in use (fmOpenRead or fmShareDenyNone) 2a. If file could be opend zip it 2b. If file could not be opend skip the file call OnSkippingFile Instead VCLZip act as 2c. If file cound not be opend create a 0 Byte file and give no error message.... This is not a usefull behaviour and the question is how I can get VCLZip to give an error message when opening a file fails.
|
|
|
Post by Kevin on Oct 26, 2008 9:06:49 GMT -5
What you are asking should be the case. If VCLZip is saving a zero byte file then it was able to open the file and it zipped it best as it could. If the file was truly blocked and VCLZip was not able to open it then OnSkipping file should be getting called. If it was able to open the file and you ended up with 0 bytes, I know this will happen in cases where the file was just created, and nothing has been flushed to disk yet.
|
|
ares
New Member
Posts: 12
|
Post by ares on Oct 26, 2008 11:08:28 GMT -5
What you are asking should be the case. If VCLZip is saving a zero byte file then it was able to open the file and it zipped it best as it could. If the file was truly blocked and VCLZip was not able to open it then OnSkipping file should be getting called. If it was able to open the file and you ended up with 0 bytes, I know this will happen in cases where the file was just created, and nothing has been flushed to disk yet.
The file to be zipped is an existing Word file which is currently in use. The file has a size of 2.3 MB. So it is not about zipping a file which has just been created and not yet written to disk...
Is there any possibility to filter out files which have a size of 0 Bytes during zipping?
|
|
|
Post by Kevin on Oct 26, 2008 13:53:31 GMT -5
I'm not sure why in your case it is allowing it to open the file yet not get any data from it.
As for filtering the files with zero bytes. when the OnStartZip event (OnStartZipInfo) is called, just before the zipping process begins, there is a parameter passed in to that event called ZipHeader which has a property called uncompressed_size that you can check. If it is zero, you can set the Skip parameter to true and it won't be zipped.
|
|