bool runtime_FileUtils_setSearchPaths(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setSearchPaths : Invalid Native Object"); if (argc == 1) { std::vector<std::string> vecPaths, writePaths; ok &= jsval_to_std_vector_string(cx, args.get(0), &vecPaths); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setSearchPaths : Error processing arguments"); std::vector<std::string> originPath; // for IOS platform. std::vector<std::string> projPath; // for Desktop platform. for (int i = 0; i < vecPaths.size(); i++) { if (!FileUtils::getInstance()->isAbsolutePath(vecPaths[i])) { originPath.push_back(vecPaths[i]); // for IOS platform. projPath.push_back(g_projectPath+vecPaths[i]); //for Desktop platform. writePaths.push_back(FileServer::getShareInstance()->getWritePath() + vecPaths[i]); } } #if(CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) vecPaths.insert(vecPaths.end(), projPath.begin(), projPath.end()); #endif if (FileServer::getShareInstance()->getIsUsingWritePath()) { vecPaths.insert(vecPaths.end(), writePaths.begin(), writePaths.end()); } else { vecPaths.insert(vecPaths.end(), originPath.begin(), originPath.end()); } cobj->setSearchPaths(vecPaths); args.rval().setUndefined(); return true; } JS_ReportError(cx, "js_cocos2dx_FileUtils_setSearchPaths : wrong number of arguments: %d, was expecting %d", argc, 1); return false; }
bool js_PluginFacebookJS_PluginFacebook_login(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; do { if (argc == 1) { std::vector<std::string> arg0; ok &= jsval_to_std_vector_string(cx, args.get(0), &arg0); if (!ok) { ok = true; break; } sdkbox::PluginFacebook::login(arg0); return true; } } while (0); do { if (argc == 0) { sdkbox::PluginFacebook::login(); return true; } } while (0); JS_ReportError(cx, "js_PluginFacebookJS_PluginFacebook_login : wrong number of arguments"); return false; }