Cocos2d-x3.0 解压zip

来源:未知 责任编辑:责任编辑 发表时间:2014-05-20 18:26 点击:

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

 

先引入头文件

 

#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-x学习笔记(19)--label 、label atlas
    • cocos2d-x学习笔记(23)--地图的使用3--CCTMXLayer
    • Cocos2d-x学习(一):HelloWorld
    • cocos2dx在xcode下开发,编译到android上(2)
    • cocos2d 设置屏幕默认方向
    • cocos2d-x学习笔记(22)--地图的使用2(TMX) --Z-Order、AnchorPoi
    • Cocos2d-x 2.0 之 Actions “三板斧” 之一
    • cocos2d-x学习笔记(18)--游戏打包(windows平台)
    • cocos2d-x学习笔记(16)--spritesheet(精灵表单)
    网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
    Copyright © 2008-2015 计算机技术学习交流网. 版权所有

    豫ICP备11007008号-1