本文整理汇总了C++中FileUtils::getWritablePath方法的典型用法代码示例。如果您正苦于以下问题:C++ FileUtils::getWritablePath方法的具体用法?C++ FileUtils::getWritablePath怎么用?C++ FileUtils::getWritablePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils::getWritablePath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printFileUtils
static void printFileUtils(int fd)
{
FileUtils* fu = FileUtils::getInstance();
mydprintf(fd, "\nSearch Paths:\n");
auto list = fu->getSearchPaths();
for( const auto &item : list) {
mydprintf(fd, "%s\n", item.c_str());
}
mydprintf(fd, "\nResolution Order:\n");
list = fu->getSearchResolutionsOrder();
for( const auto &item : list) {
mydprintf(fd, "%s\n", item.c_str());
}
mydprintf(fd, "\nWriteble Path:\n");
mydprintf(fd, "%s\n", fu->getWritablePath().c_str());
mydprintf(fd, "\nFull Path Cache:\n");
auto cache = fu->getFullPathCache();
for( const auto &item : cache) {
mydprintf(fd, "%s -> %s\n", item.first.c_str(), item.second.c_str());
}
}
示例2: initResourcePath
void AppDelegate::initResourcePath()
{
FileUtils* sharedFileUtils = FileUtils::getInstance();
std::string strBasePath = sharedFileUtils->getWritablePath();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)|| (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
sharedFileUtils->addSearchPath("res/");
#else
sharedFileUtils->addSearchPath("../../res/");
#endif
sharedFileUtils->addSearchPath(strBasePath + "upd/", true);
}
示例3: initResourcePath
void AppDelegate::initResourcePath()
{
FileUtils* sharedFileUtils = FileUtils::getInstance();
//设置SearchPaths
std::vector<std::string> oldSearchPaths = sharedFileUtils->getSearchPaths();
std::vector<std::string> tempPaths(oldSearchPaths);
std::vector<std::string> searchPaths;
searchPaths.push_back(sharedFileUtils->getWritablePath() + "upd/");
searchPaths.push_back("res/");
searchPaths.push_back("src/");
for (int i = 0; i < tempPaths.size(); ++i) {
searchPaths.push_back(tempPaths[i]);
}
sharedFileUtils->setSearchPaths(searchPaths);
// MyUnZip::getInstance()->UnZipFile("/Users/binW/Downloads/game.zip", "/Users/binW/Downloads/", PrintfText);
}
示例4: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
//#if (COCOS2D_DEBUG>0)
// initRuntime();
//#endif
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
Size viewSize = ConfigParser::getInstance()->getInitViewSize();
std::string title = "VeewoGames";
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
extern void createSimulator(const char* viewName, float width, float height,bool isLandscape = true, float frameZoomFactor = 1.0f);
bool isLanscape = ConfigParser::getInstance()->isLanscape();
createSimulator(title.c_str(),viewSize.width,viewSize.height,isLanscape);
#else
glview = cocos2d::GLViewImpl::createWithRect(title.c_str(), Rect(0,0,viewSize.width,viewSize.height));
log(">>>>>>> enter the config");
director->setOpenGLView(glview);
#endif
}
log(">>>>>>> enter the hehehehe");
cocosbuilder::CCBReader::setResolutionScale(1);
FileUtils* fileutils = FileUtils::getInstance();
VeeResUpdate::getInstance()->checkLocalUpdate();
std::vector<std::string> paths = fileutils->getSearchPaths();
paths.insert(paths.begin(), "res");
paths.insert(paths.begin(), fileutils->getWritablePath());
paths.insert(paths.begin(), fileutils->getWritablePath() + "update/");
fileutils->setSearchPaths(paths);
// fileutils->cacheFile("xxx.ccbi", true);
director->setAnimationInterval(1.0 / 60);
ScriptingCore* sc = ScriptingCore::getInstance();
sc->addRegisterCallback(register_all_cocos2dx);
sc->addRegisterCallback(register_all_cocos2dx_extension);
sc->addRegisterCallback(register_cocos2dx_js_extensions);
sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
// sc->addRegisterCallback(jsb_register_chipmunk);
sc->addRegisterCallback(jsb_register_system);
sc->addRegisterCallback(JSB_register_opengl);
sc->addRegisterCallback(register_all_cocos2dx_builder);
sc->addRegisterCallback(register_CCBuilderReader);
sc->addRegisterCallback(register_all_pluginx_protocols);
sc->addRegisterCallback(register_pluginx_js_extensions);
// sc->addRegisterCallback(register_all_cocos2dx_ui);
// sc->addRegisterCallback(register_all_cocos2dx_ui_manual);
// sc->addRegisterCallback(register_all_cocos2dx_studio);
// sc->addRegisterCallback(register_all_cocos2dx_studio_manual);
//
// sc->addRegisterCallback(register_all_cocos2dx_spine);
// sc->addRegisterCallback(register_all_cocos2dx_spine_manual);
sc->addRegisterCallback(MinXmlHttpRequest::_js_register);
sc->addRegisterCallback(register_jsb_websocket);
sc->addRegisterCallback(register_jsb_socketio);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
#endif
sc->addRegisterCallback(register_all_veewo_extension);
//#if (COCOS2D_DEBUG>0)
// if (startRuntime())
// return true;
//#endif
ScriptingCore::getInstance()->start();
auto engine = ScriptingCore::getInstance();
ScriptEngineManager::getInstance()->setScriptEngine(engine);
ScriptingCore::getInstance()->runScript(ConfigParser::getInstance()->getEntryFile().c_str());
VeeResUpdate::getInstance()->checkUpdate();
return true;
}
示例5: init
void Global::init(){
FileUtils* fu = FileUtils::getInstance();
std::string path = fu->getWritablePath();
g_fileName = fu->fullPathFromRelativeFile("ayh_7670943822e01e", path);
}