void jsb_register_system( JSContext *_cx,  JS::HandleObject object)
{
    //
    // sys
    //
    JS::RootedObject proto(_cx);
    JS::RootedObject parent(_cx);
    JS::RootedObject sys(_cx, JS_NewObject(_cx, nullptr, proto, parent));
    JS::RootedValue systemVal(_cx);
    systemVal.set(OBJECT_TO_JSVAL(sys));
    JS_SetProperty(_cx, object, "sys", systemVal);


    // sys.localStorage
    JSObject *ls = JS_NewObject(_cx, nullptr, proto, parent);
    JS::RootedValue lsVal(_cx);
    lsVal.set(OBJECT_TO_JSVAL(ls));
    JS_SetProperty(_cx, sys, "localStorage", lsVal);

    // sys.localStorage functions
    JS::RootedObject system(_cx, ls);
#include "scripting/js-bindings/manual/localstorage/js_bindings_system_functions_registration.h"
    
    // Init DB with full path
    //NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    //NSString *fullpath = [path stringByAppendingPathComponent:@"jsb.sqlite"];
    std::string strFilePath = cocos2d::FileUtils::getInstance()->getWritablePath();
    strFilePath += "/jsb.sqlite";
    localStorageInit(strFilePath);
    
}
void SaveLoad::Init()
{
    char path[256];
    sprintf(path,"%s%s",CCFileUtils::sharedFileUtils()->getWriteablePath().c_str(),"CTMData.bin");
    localStorageInit(path);
    
    Load();
    
}
CommonHttpManager::CommonHttpManager()
: m_pActivityIndicatorView(NULL)
{
    for (int i=0; i<REQUEST_JSON_COUNT; i++)
    {
        CAHttpClient* httpClient = CAHttpClient::getInstance(15 - i);
        httpClient->setTimeoutForConnect(10);
        httpClient->setTimeoutForRead(10);
        m_pHttpJsonClients.push_back(httpClient);
    }
    for (int i=REQUEST_JSON_COUNT; i<REQUEST_JSON_COUNT + REQUEST_IMAGE_COUNT; i++)
    {
        CAHttpClient* httpClient = CAHttpClient::getInstance(15 - i);
        httpClient->setTimeoutForConnect(10);
        httpClient->setTimeoutForRead(10);
        m_pHttpImageClients.push_back(httpClient);
    }
    

    std::string fullPath = CCFileUtils::sharedFileUtils()->getWritablePath() + "cartoon_house_url.db";
    localStorageInit(fullPath.c_str());
    CommonImageCacheManager::getInstance();
}
		void LocalStore::resetStoreFile(std::string& strStoreFile)
		{
			std::string strFilePath = FileUtils::getInstance()->getWritablePath() + "/data/" + strStoreFile;
			localStorageFree();
			localStorageInit(strFilePath.c_str());
		}
Beispiel #5
0
void GBSqlite::initDB(const std::string& dbName)
{
	localStorageInit(FILE()->getWritablePath() + dbName);
}