PureZIP library : ZIP / UNZIP files

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

Moderator: gnozal

User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

Thanks a lot! :D
I not really understand why, but your right.
Now it works perfect.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Max
User
User
Posts: 67
Joined: Thu Nov 30, 2006 4:57 pm
Location: I long for the absolute loneliness of the death

Post by Max »

to gnozal

How to code when I need to compress a recursive folder (with PureZIP_AddFiles) which contains some files with accented characters?

PureZIP_AsciiDosLatinUS_To_AsciiWinLatin1 only transforms one string every time.

Yes, I can make ExamineDirectory (recursive) and transform one by one...but it's very heavy.. if we've some other option....
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Max wrote:to gnozal
How to code when I need to compress a recursive folder (with PureZIP_AddFiles) which contains some files with accented characters?

PureZIP_AsciiDosLatinUS_To_AsciiWinLatin1 only transforms one string every time.
I am afraid you have to code your own recursive routine.
Max wrote:Yes, I can make ExamineDirectory (recursive) and transform one by one...but it's very heavy.. if we've some other option....
Not so heavy.
There is an example of recursive zipping (with relative paths) three posts above.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Philippe-felixer76
User
User
Posts: 57
Joined: Mon Dec 18, 2006 2:02 pm
Location: Holland

UNZIP and PNG imagedecoder

Post by Philippe-felixer76 »

I might be wrong, but is it possible when using
this great zip library with the pngimage decoder,
you get the message:

POLINK: error: Symbol '_inflate_copyright'is myltiply defined......
User avatar
AL90
Enthusiast
Enthusiast
Posts: 217
Joined: Fri Sep 16, 2005 7:47 pm
Location: Germany
Contact:

Re: UNZIP and PNG imagedecoder

Post by AL90 »

Philippe-felixer76 wrote:POLINK: error: Symbol '_inflate_copyright'is myltiply defined......
Do you use PureZIP_AddFiles() ? With this command I get also some
problems in real TotalCommander. TC will give an error like Unknown Format if I want Delete a File in Archive.
But the Archive is not corrupt. All Files can be normal Extracting. Now I use
PureZIP_Archive_Compress() and it will work better. Also in TC are
now no longer problems.
Possibly a bug in PureZIP_AddFiles ? Currently I rewrite my Tool

Pure FileMaster

and will replace all AddFiles() with ArchiveCompress() for more
compatiblity in next version (v1.3)

Sorry for my bad English!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: UNZIP and PNG imagedecoder

Post by gnozal »

Philippe-felixer76 wrote:I might be wrong, but is it possible when using
this great zip library with the pngimage decoder,
you get the message:
POLINK: error: Symbol '_inflate_copyright'is myltiply defined......
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.
I don't know how to fix this.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Max
User
User
Posts: 67
Joined: Thu Nov 30, 2006 4:57 pm
Location: I long for the absolute loneliness of the death

Re: UNZIP and PNG imagedecoder

Post by Max »

AL90 wrote: Do you use PureZIP_AddFiles() ? With this command I get also some
problems in real TotalCommander. TC will give an error like Unknown Format if I want Delete a File in Archive.
But the Archive is not corrupt. All Files can be normal Extracting.
Well, I'm also using TC (beta 3 at moment), and I've not any problem with PureZip, even deleting files from TC.
I'm using PureZIP_AddFiles()

Code: Select all

Procedure Zipear(zipf.s, param.s, recur.l)
  DeleteFile(zipf)
  nFi = PureZIP_AddFiles(zipf, param, #PureZIP_StorePathRelative, recur)
  WriteStringn(nFilog,"Comprimidos "+rset(str(nFi),6)+ " : "+GetFilePart(zipf))
EndProcedure
I've tested it now again, with my last night backups, and no problem...
User avatar
AL90
Enthusiast
Enthusiast
Posts: 217
Joined: Fri Sep 16, 2005 7:47 pm
Location: Germany
Contact:

Post by AL90 »

@Max

I use wildcards like this:

PureZIP_AddFiles(ZipFile$,fm_tmp$+"*.*",2,2)

and archive contains which is created so will TC not delete.
Now I'm finish with rewrite my Procedures and I have replace
all PureZIP_AddFiles() to PureZIP_Archive_Compress().
Result: TC will no longer get any errors and all works fine.
I can't explain why it is so. BTW: I have use any older TC version (6.51)
not the latest.

BTW:

PureZIP_AddFiles() will get #Null if I e.g. add an Empty Directory and
PureZIP_Archive_Compress() will get -1. I'm not sure if it is normal.
But I think it is IMHO not correct?!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AL90 wrote:I use wildcards like this:
PureZIP_AddFiles(ZipFile$,fm_tmp$+"*.*",2,2)
and archive contains which is created so will TC not delete.
Probably because you are using #PureZIP_RecursiveZeroDirs (help file : 'recursive file search and add empty directories (use only if necessary)').
It's a trick to add empty dirs (wich the ZLIB library I use does not normally allow), so the ZIP structure may be a little 'weird' for some archivers. But while it does not allow archive modification, the extraction works.
Do you also have this problem with #PureZIP_Recursive ?
AL90 wrote:BTW:
PureZIP_AddFiles() will get #Null if I e.g. add an Empty Directory and
PureZIP_Archive_Compress() will get -1. I'm not sure if it is normal.
But I think it is IMHO not correct?!
This is correct :
PureZIP_Archive_Compress() can't add a directory, it's for files, so you get an error.
Or the other hand, PureZIP_AddFiles() tolerates empty dirs, but an empty dir has no files in it, so it returns 0 (filecount).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
AL90
Enthusiast
Enthusiast
Posts: 217
Joined: Fri Sep 16, 2005 7:47 pm
Location: Germany
Contact:

Post by AL90 »

gnozal wrote:Do you also have this problem with #PureZIP_Recursive ?
Yes. How I say I use Recursive. (See on Top) I have make a new test
with TC now and it the same problem:

ZIP-Archive is defekt or has a unknown format!

but (also complete) Extraction is possible without errors.
Yourself can test it with PFM v1.2. BTW: I have now successfully
converted all AddFiles() in ArchiveCompress() and all will now
work 100% without errors. (Also TC will work now without errors)
But I can't more exact explain this phänomen. Sorry.
I will release 1.3 in the next few days. If you want you can
test it then in combination with real TC.
This is correct :
PureZIP_Archive_Compress() can't add a directory, it's for files, so you get an error.
Or the other hand, PureZIP_AddFiles() tolerates empty dirs, but an empty dir has no files in it, so it returns 0 (filecount).
Ok I think I understand you now.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AL90 wrote:
gnozal wrote:Do you also have this problem with #PureZIP_Recursive ?
Yes. How I say I use Recursive.
In your example you use #PureZIP_RecursiveZeroDirs (2) and not #PureZIP_Recursive (1).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
AL90
Enthusiast
Enthusiast
Posts: 217
Joined: Fri Sep 16, 2005 7:47 pm
Location: Germany
Contact:

Post by AL90 »

gnozal wrote:In your example you use #PureZIP_RecursiveZeroDirs (2) and not #PureZIP_Recursive (1).
Yes, because I want add empty dirs. For my Tool I cannot ignore
selected EmptyDirs while copying. (same in real TC)
Morty
User
User
Posts: 35
Joined: Mon Mar 19, 2007 8:30 am
Location: Germany
Contact:

Post by Morty »

Hi at all.

I have a problem using this lib.
If I add an tga file, this file will be destroyed (inside the zip file and after decompressing). I can't use it after decompression.

Here's an example code:

Code: Select all

MyZip.s="C:\test\zip_test.zip"
MyZIPFile1.s="C:\Test\test_tga.tga"

If PureZIP_Archive_Create(MyZIP.s, #APPEND_STATUS_CREATE)
  Debug PureZIP_Archive_Compress(MyZIPFile1.s, #False)
  PureZIP_Archive_Close()
EndIf
Taken from the helpfile.

Here is the image: http://www.morty-productions.de/zip_bug/test_tga.tga

And here is an image showing my problem:
Image

I use PB 4.00 running on Win XP Professional. Downloaded the latest version of the library.

Hope someone could help.

Greetz, Morty

PS: Sorry for my bad english.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Morty wrote:Hi at all.

I have a problem using this lib.
If I add an tga file, this file will be destroyed (inside the zip file and after decompressing). I can't use it after decompression.


I use PB 4.00 running on Win XP Professional. Downloaded the latest version of the library.
Note that there is a bug in the PB4.00 file library.
http://www.purebasic.fr/english/viewtop ... c&start=44
Please upgrade to PB4.02 and test again.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update (Both libs)

Changes :
- (de)compression callback [set with PureZIP_SetCompressionCallback(*ProcedureAddress)] : if the callback returns #True, the (de)compression stops and the function returns a #PureZIP_CallbackStop error.

Code: Select all

Returned value [only for PureZIP_Archive_Compress() and PureZIP_Archive_Extract()] :
#FALSE :  compression / extraction continues
#TRUE  :  compression / extraction stops !
          PureZIP_Archive_Compress() and PureZIP_Archive_Extract() returns #PureZIP_CallbackStop error
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply