【发布时间】:2018-11-06 22:34:10
【问题描述】:
我正在重新审视几年前的源代码,它曾经可以完美编译,但现在项目中有一个错误我无法弄清楚。
我有以下代码:
void AssetsManager::destroyStoragePath()
{
// Delete recorded version codes.
deleteVersion();
// Remove downloaded files
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
FileUtils::getInstance()->removeDirectory(_storagePath.c_str());
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
string command = "rd /s /q ";
// Path may include space.
command += "\"" + _storagePath + "\"";
system(command.c_str());
#else
string command = "rm -r ";
// Path may include space.
command += "\"" + _storagePath + "\"";
system(command.c_str());
#endif
}
NS_CC_EXT_END;`
我收到以下错误:
“调用不可用的函数‘系统’:在 iOS 上不可用”
如何解决这个错误?
【问题讨论】:
-
要删除资产,您可以使用文件管理器方法
removeItem。我不太确定上面的代码你想达到什么目的。