Bug in the PureZIP lib for PB4?

Everything else that doesn't fall into one of the other PB categories.
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Bug in the PureZIP lib for PB4?

Post by GeoTrail »

I think I've found a bug in PureZIP for PB4.
When I run this code

Code: Select all

OpenConsole()

MyZIP.s = "C:\TestFile.zip"
Path.s  = "C:\Picasa2\*.*"

If PureZIP_Archive_Create(MyZIP.s, #APPEND_STATUS_CREATE)
  PrintN("Compressing files, please wait...")
  PrintN("")

  PureZIP_AddFiles(MyZIP.s, Path.s, #PureZIP_StorePathRelative, #PureZIP_Recursive)

  PureZIP_Archive_Close()
  PrintN("")
  PrintN("Compression completed!")
EndIf

PrintN("Archive contains "+Str(PureZIP_GetFileCount(MyZIP.s))+" files.")

PrintN("")
PrintN("Press any key to exit!")
Input()

CloseConsole()
All files in the Picasa folder is compressed along with the subfolders and files. One thing I notices is that in every folder below the root of the archive there is an empty file, with no name. I can't open the file in the archive, but it says it is 0 bytes uncompressed when I open it in WinRAR, compressed the file is 2 bytes.

When I compress a folder containing 34 files and 5 folders, PureZIP_GetFileCount reports it compressed 40 files. Is that the extra empty file it's counting?

Any feedback on this?
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

1. You don't need PureZIP_Archive_Create() / PureZIP_Archive_Close() when you use PureZIP_AddFiles(). Use these functions with the other PureZIP_Archive_* functions.

2. These empty files you see if you are using another archiver are a (dumb) workaround to add empty directories to the archive when using PureZIP_AddFiles(). It may look strange in another archiver but unpacks without any problem.

3. I don't know how to add empty directories otherwise (user wish) : I will make it optional.

4. PureZIP_GetFileCount() is only a wrapper for ZLIB function unzGetGlobalInfo().

Library updated : http://www.purebasic.fr/english/viewtopic.php?p=152619
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply