我是 cocos2d-x 的新手,在编译我的项目时出现此错误。
调用不可用的功能“系统”:在 iOS 上不可用
我看到这个调用不再适用,但是我可以用什么来代替它? 任何见解将不胜感激!
bool FileUtils::removeDirectory(const std::string& path)
{
#if !defined(CC_TARGET_OS_TVOS)
std::string command = "rm -r ";
// Path may include space.
command += "\"" + path + "\"";
if (system(command.c_str()) >= 0) /*System Call Error/Not Availible*/
return true;
else
return false;
#else
return false;
#endif
}
系统功能在iOS 11上不可用 利用这个时间直到 10 月 9 日我们就可以拥有新的 cocos2d-x 3.16
if (命令.size() >= 0)
我还没有证实这一点,但你可以尝试如下:
// This is ugly, but it should work
if (fork() == 0)
{
string fullpath = "\"" + _storagePath + "\"";
string arg1 = "-r";
char* args[] =
{
&arg1.at(0),
&fullpath.at(0),
nullptr,
};
const char* command = "rd";
execvp(command, args);
}