PureZIP library : ZIP / UNZIP files

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

What a pity!
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Library update

Changes
- fixed empty directory storing in archive (if StorePath enabled)

Code: Select all

; Dir structure : 
; 
; +Purebasic394 
; |_+Program 
;   |_+Empty 
;     |_Empty 
;
PureZIP_AddFiles("TEST.zip", "c:\PureBasic394\program\empty\*.*", #PureZIP_StorePathAbsolute, #True) 
PureZIP_ExtractFiles("TEST.zip", "*.*", "c:\PureBasic394\Program\", #True)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

@gnozal,

Thanks for your very fast support.
It works as specified now ;-)
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Note :
There is a known problem with PureZIP and the ImagePluginPNG purebasic library. If you use both in the same program, you will get a POLINK error "Symbol '_inflate_copyright' is multiply defined" because both use the ZLIB static library.
Any easy way around this (apart from not using both at the same time!)... ?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

DoubleDutch wrote:
Note :
There is a known problem with PureZIP and the ImagePluginPNG purebasic library. If you use both in the same program, you will get a POLINK error "Symbol '_inflate_copyright' is multiply defined" because both use the ZLIB static library.
Any easy way around this (apart from not using both at the same time!)... ?
I tried to modify the name of the functions, like '_inflate_copyright' -> '_inflate-copyright' : it does compile without error, PureZIP functions work, but PNG functions crash. So I don't know how to fix this. Sorry.

Maybe Fred knows how to fix this : viewtopic.php?t=18074 ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

From the link it looks like there is a problem. Hopefully Fred will look at this before v4 is released and there will be a fix (if possible)...
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

Gnozal, first at all, thank you for this lib!

Are there any option to refresh better the CallBack for BIG files?; With small files it works great, but when I try to compress a 3Gb file, don't works appropriately

Code: Select all

Procedure CallbackForTest(file.s, PerCent.f)
    Debug StrF(PerCent, 2) + "%"
EndProcedure

PureZIP_SetCallback(@CallbackForTest())


myzipfile1.s = "c:\images\image001.img" ;/3 Gb

If PureZIP_Archive_Create("c:\bck\image.zip", #APPEND_STATUS_CREATE) 
    PureZIP_Archive_Compress(myzipfile1.s, #False) 
    PureZIP_Archive_Close() 
EndIf
PB 6.21 beta, PureVision User
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Are there any option to refresh better the CallBack for BIG files?; With small files it works great, but when I try to compress a 3Gb file, don't works appropriately
I agree the actual callback is very primitive : Progression = FileProcessed / TotalFilesToProcess * 100, and it only works for the following functions : PureZIP_ExtractFiles(), PureZIP_AddFiles().
It is not implemented for the PureZIP_Archive_* functions you are using.

There is no compression progress callback at the moment like the PackerCallback() in Purebasic, because the ZLIB function zipWriteInFileInZip() don't support a callback, IIRC.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

Please, any sample of

Code: Select all

PureZIP_Archive_FileInfo(*FileInfo.PureZIP_FileInfo)
and/or

Code: Select all

PureZIP_GetFileInfo(ArchiveFileName.s, FileNumberInArchive.l, *FileInfo.PureZIP_FileInfo) 
I'm tryng to get de Date of a file, but I don't know How can I do it :oops:
(I'm using this code:

Code: Select all

...
If PureZIP_GetFileInfo(ZIPACOMPARAR$, ReturnValue, @myFileinfo.PureZIP_FileInfo) 
     f$ = FormatDate("%yyyy%mm%dd", myFileinfo\dosdate)
     Debug archivoActual + " -> DATE: " + f$
endif
but it returns incorrect date.

... and, again... thank you for this lib!
PB 6.21 beta, PureVision User
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

zikitrake wrote:I'm tryng to get de Date of a file, but I don't know How can I do it :oops: ...
You have to use the tmu_date.tm.date structure
Please try the following code :

Code: Select all

MyZIP.s = "C:\PureBasic394\Program\test.zip"
; Get files information
For i = 0 To PureZIP_GetFileCount(MyZIP) - 1 
  Debug PureZIP_GetFileInfo(MyZIP,i , @myFileinfo.PureZIP_FileInfo)
  Debug "Number " + Str(i)
  Debug "Filename: " + myFileinfo\FileName
  Debug "Compressed Size: " + Str(myFileinfo\CompressedSize)
  Debug "Uncompressed Size: "+ Str(myFileinfo\unCompressedSize)
  ; FILE DATE --------------
  ; IMPORTANT : tmu_date\tm_mon  = [0 - 11] : you have to add 1 to tm_mon to get the correct month
  Debug "Last Modification Date : " + Str(myFileinfo\tmu_date\tm_mday) + "/" + Str(myFileinfo\tmu_date\tm_mon + 1) + "/" + Str(myFileinfo\tmu_date\tm_year) + " " + Str(myFileinfo\tmu_date\tm_hour) + ":" + Str(myFileinfo\tmu_date\tm_min) + ":" + Str(myFileinfo\tmu_date\tm_sec)
  ; ------------------------
Next
Note : I just discovered this tm_mon [0 - 11] thing now :oops: ...
PureZIP does not handle the file date correctly when compressing / extracting (I forgot to add/substract 1 to tm_mon when compressing / extracting).
Expect a bug fix soon.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

gnozal wrote:
zikitrake wrote:I'm tryng to get de Date of a file, but I don't know How can I do it :oops: ...
Note : I just discovered this tm_mon [0 - 11] thing now :oops: ...
PureZIP does not handle the file date correctly when compressing / extracting (I forgot to add/substract 1 to tm_mon when compressing / extracting).
Expect a bug fix soon.
Really... very thank you... it works great :D, but

Code: Select all

Str(myFileinfo\tmu_date\tm_mon + 1) 
retrieves an incorrect month;

Code: Select all

Str(myFileinfo\tmu_date\tm_mon)
works fine

thank you again
PB 6.21 beta, PureVision User
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

zikitrake wrote:
gnozal wrote:
zikitrake wrote:I'm tryng to get de Date of a file, but I don't know How can I do it :oops: ...
Note : I just discovered this tm_mon [0 - 11] thing now :oops: ...
PureZIP does not handle the file date correctly when compressing / extracting (I forgot to add/substract 1 to tm_mon when compressing / extracting).
Expect a bug fix soon.
Really... very thank you... it works great :D, but

Code: Select all

Str(myFileinfo\tmu_date\tm_mon + 1) 
retrieves an incorrect month;

Code: Select all

Str(myFileinfo\tmu_date\tm_mon)
works fine

thank you again
I am confused :shock:
Using PB 3.94/NT4
A few tests :
1.
- I create a ZIP file (NOT with PureZIP)
- I list the files with PureZIP
- tm_mon is false (real month - 1) BUT :
- I list the files with 2 external ZIP tools : file date Ok
2.
- I create a ZIP file (WITH PureZIP)
- I list the files with PureZIP
- tm_mon is good BUT :
- I list the files with 2 external ZIP tools : file date is wrong : month is month + 1

Could you test this ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

gnozal wrote:I am confused :shock:
Using PB 3.94/NT4
A few tests :
1.
- I create a ZIP file (NOT with PureZIP)
- I list the files with PureZIP
- tm_mon is false (real month - 1) BUT :
- I list the files with 2 external ZIP tools : file date Ok
2.
- I create a ZIP file (WITH PureZIP)
- I list the files with PureZIP
- tm_mon is good BUT :
- I list the files with 2 external ZIP tools : file date is wrong : month is month + 1

Could you test this ?
Yes, I obtain the same results.
PB 6.21 beta, PureVision User
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

zikitrake wrote: Yes, I obtain the same results.
Thanks !
It's logical : PureZIP does not substract/add 1 to tm_mon when compressing / extracting, so PureZIP is coherent with itself but not compatible with the other archivers. It will be fixed.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

gnozal wrote:
zikitrake wrote: Yes, I obtain the same results.
Thanks !
It's logical : PureZIP does not substract/add 1 to tm_mon when compressing / extracting, so PureZIP is coherent with itself but not compatible with the other archivers. It will be fixed.
Thank you for your fast reply.
PB 6.21 beta, PureVision User
Post Reply