Example #1
0
void initRuntime()
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    vector<std::string> searchPathArray = FileUtils::getInstance()->getSearchPaths();
    
    extern std::string getCurAppPath();
    std::string appPath = getCurAppPath();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
    appPath.append("/../../");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    appPath.append("/../../../");
#endif
    appPath = replaceAll(appPath, "\\", "/");
    g_projectPath = appPath;
    
    // add project's root directory to search path
    searchPathArray.insert(searchPathArray.begin(), g_projectPath);
    
    // add writable path to search path
    searchPathArray.insert(searchPathArray.begin(), FileServer::getShareInstance()->getWritePath());
    FileUtils::getInstance()->setSearchPaths(searchPathArray);
#endif
    

    ConsoleCommand::getShareInstance()->init();
}
Example #2
0
void initRuntime()
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    vector<std::string> searchPathArray = FileUtils::getInstance()->getSearchPaths();
    
    extern std::string getCurAppPath();
    std::string appPath = getCurAppPath();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
    appPath.append("/../../");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
    appPath.append("/../../../");
#endif
    appPath = replaceAll(appPath, "\\", "/");
    g_projectPath = appPath;
    
    // add project's root directory to search path
    searchPathArray.insert(searchPathArray.begin(), g_projectPath);
    
    // add writable path to search path
    searchPathArray.insert(searchPathArray.begin(), FileServer::getShareInstance()->getWritePath());
    FileUtils::getInstance()->setSearchPaths(searchPathArray);
#endif

    auto engine = LuaEngine::getInstance();
    ScriptEngineManager::getInstance()->setScriptEngine(engine);
    register_runtime_override_function(engine->getLuaStack()->getLuaState());

    ConsoleCommand::getShareInstance()->init();
}
Example #3
0
std::string getAppPath()
{
	std::string appPath = getCurAppPath();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
	appPath.append("/../");
#endif
	appPath = replaceAll(appPath, "\\", "/");
	appPath = QFileInfo(appPath).absolutePath();
	appPath.append("prop/");
	return appPath;
}