Downloading and uncompressing a zip file

I’m currently attempting to download a zip file from a website and then uncompress it onto my desktop.
So far this is the only way I’ve managed to do it:

URL zipUrl ("");
InputStream* urlStream = zipUrl.createInputStream (true);
ZipFile zipFile (urlStream, true);
zipFile.uncompressTo(File::getSpecialLocation (File::userDesktopDirectory));

However this produces some errors:

  • Xcode is warning me of several “Object xxx of class NSCFString autoreleased with no pool in place - just leaking” warnings
  • I can’t seem to open any of my uncompressed files - they’re either not recognised, come up with ‘permission denied’, or just won’t open
  • It produces a empty __MAXOSX folder alongside it

So I get the feeling my code above isn’t quite right.
Could anyone provide any insight?


Just tried simply uncompressing a zip file I created locally, but I’m having the same problems. My .app files aren’t opening and my unix executable files aren’t be recognised as having the correct file format. However when manually uncompressing the file using the OS system all is fine.

Is this a bug within the ZipFile class? I’m using Mac OS X.

I’ve used it a lot and never had a problem with it… You need to get in there with the debugger and watch what it does.

Found that the problem I’m having is the same as described here -
Calling chmod 775 on the uncompressed executables in the terminal fixes the problem.

How would I be able to do this chmod 775 call directly within my app?

Found a chmod() function that can be used to change a files permissions -

So after uncompressing the zip file you can call this function passing in the executable files, for example:

chmod (appFile.getFullPathName().toUTF8(), S_IRWXO | S_IRWXU | S_IRWXG);

Maybe this kind of thing is worth adding to the ZipFile class itself?