Compressing the folder

Hi Jules,

How can one compress the folder. There is “GZIPCompressorOutputStream” class, but using it i cant compress the folder. One thing i can do is just write files from folder as stream.
Is there a way to compress the folder so that uncompressing it will yield me the original files.

Regards,
Godwin

as far as I know, GZIP format doesn’t store directory structure, so you can compress/decompress only a single file per GZIP file.
That’s why, on unix platforms, it’s common to see TAR archives (which store a folder into a single file) that are GZIPped.

i had the same problem, but i wrote a small class to write zip files, you can just add File() objects to it and it will spit out a zip file with those file in it, it has a amalgamated minizip.c library to do the zip write stuff, it works for me. the code is here

http://edoapp.googlecode.com/svn/trunk/src/Core/EdoZipWrite/

Thanks for the reply Atom

Did u write the code foe mac as well…
I m on cross platform so i need the mac code as well…

Thanks and Regards
Godwin

i guess it should be, the minizip library works on linux and win32 i see no reason it wouldnt work on mac (osx has zlib installed by default) and the class is pure JUCE so that will work definetly. i dont have a mac to check.

There is variables of type HANDLE and other type in the minizip.c file…
And due to that its not compiling in mac…

it’s because iowin32.h is bundled in there, just add a IFDEF WIN32 before the
/********* Start of inlined file: iowin32.c *********/

and you should be set, if not just get minizip http://www.winimage.com/zLibDll/minizip.html from here and use thhat, this is just my version.

Actually i saw it … And i was initially working on mac i commented out the windows code … and it was compiling and it was giving linker error…
Confused about which library to add to project i dropped that plan…

I just used zip command with system command for mac and i created process for WINZIP32.exe to create the zip file in windows.

Anyway it was for internal use… So no worries.

there is no library to add, juce has ZLIB embedded yiu just need to point the minizip library to zlib.h in thhe juce directory (that’s what i do) and i don’t need to link to anything external since all the ZLIB symobls are in juce, so the minizip works out of the box.

that’s how i do it on win32 and linux.

This worked great for me - thanks atom.

Update : just use ZipFile class in JUCE