xcode9 bug FileUtils::removeDirectory system方法不可使用

xcode9 编译1.6.1 ios工程报错,希望能尽快修改 @jare @panda

system方法大概不允许使用了

错误截图:

,反正FileUtilsApple重写了这个方法,建议这块包一个宏

建议修改:

bool FileUtils::removeDirectory(const std::string& path)
{
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) && (CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
    return false;
#elseif
    std::string command = "rm -r ";
    // Path may include space.
    command += "\"" + path + "\"";
    if (system(command.c_str()) >= 0)
        return true;
    else
        return false;
#endif

}

对了,ios和mac下操作文件可以全部用NSFileManager提供的APi操作(removeDirectory没有用这个对象的方法),这样不用担心去担心未来api失效问题

看这个

https://github.com/cocos2d/cocos2d-x/blob/v3/cocos/platform/CCFileUtils.cpp

不过,creator用cocos引擎跟cocos2d-x不太一样 ,还是让官方来推动吧

我按照panda的 改了后 ios 运行没有问题 android 编译报错 找不到ftw.h

安卓本来就没有ftw.h 需要加上include的时候 os != android 的宏