Cocos2d-x3.0 解压zip

时间:2014-06-06 23:36:25   收藏:0   阅读:360

2dx3.0为我们集成了unzip库,帮助我们实现对文件的解压,但使用起来略显复杂我这里封装了一个解压工具库。分享一下。

工具类下载:http://download.csdn.net/detail/qqmcy/7288151


先引入头文件

#include "DJZipArchive.h"

实现解压代码


        //获取文件路径
        const char* file_path = FileUtils::getInstance()->fullPathForFilename("hello.zip").c_str();
       log("external file path = %s",file_path);
        
        DJZipArchive* djzip = new DJZipArchive();
        //file_path  zip文件的路径
        djzip->unzipOpenFile(file_path);
        
        std::string writablePath = FileUtils::getInstance()->getWritablePath();
        std::string fullPath = writablePath;
        log("%s",fullPath.c_str());
        // fullPath    解压文件储存路径
        djzip->unzipFileToAndOverWrite(fullPath, true);


Cocos2d-x3.0 解压zip,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!