Example #1
0
void Ruleset::loadDb(path dbFile) {

    static const regex getNameRegex("^.*\\\\(.*)\\.(.*)$");
    boost::smatch nameMatch;
    if(!regex_match(mFilename,nameMatch,getNameRegex)) {
        //! \todo catch this exception
        //        throw exBadName();
    }

    mName = nameMatch[1];

    // open database file
    if(sqlite3_open(dbFile.file_string().c_str(), &mDb)) {
        sqlite3_close(mDb);
        throw exDbError();
    }

    // initialise tables
    try {
        initDb(mDb);
    } catch(...) {} // ignore exception thrown if tables already exist

    // load object model from database to memory representation
    loadDb();
}
Example #2
0
        path read_symlink(
            path const & ph, 
            error_code & ec)
        {
#ifndef BOOST_WINDOWS_API
            std::string ph2;
            ph2.resize(MAX_PATH);
            int ret = ::readlink(ph.file_string().c_str(), &ph2[0], MAX_PATH);
            if (ret > 0) {
                ec = error_code();
                ph2.resize(ret);
                return path(ph2);
            } else {
                ec = framework::system::last_system_error();
                return path();
            }
#else
            return path();
#endif
        }