Ejemplo n.º 1
0
// Retrieves a list with available module ids
// static
StringList ModuleFactory::getModuleIDs()
{
    StringList list;

    boost::filesystem::path folder(dir::SHARE);
    folder /= "modules";
    // default construction yields past-the-end
    boost::filesystem::directory_iterator end_itr;
    for (boost::filesystem::directory_iterator itr(folder);
         itr != end_itr; itr++)
    {
        if (!boost::filesystem::is_regular_file(itr->status()))
            continue; // ignore directories
        // process only files with .xml extension
        boost::filesystem::path file(itr->path());
        if (file.extension() != ".xml")
            continue;

        XML xml;
        try
        {
            xml.parseFromFile(file.string());
        }
        catch(const std::exception& err)
        {
            klk_log(KLKLOG_ERROR, "Failed to get module info from '%s': %s",
                    file.string().c_str(), err.what());
            continue;
        }

        const std::string id = xml.getValue("/klkdata/module/id");
        list.push_back(id);
    }
    return list;
}
Ejemplo n.º 2
0
string ConfigurationManager::getLocation(){
    XML xml;
    char* pPath;
     pPath = getenv ("HOME");
     QString path(pPath);
     if (pPath!=NULL){
         path = path +QString(xml.getValue(xml.N_USRDESTDIR).c_str());
         QDir dir(path);
         if (!dir.exists()) {
             dir.mkpath(".");
         }
     }
    return path.toStdString();
}
Ejemplo n.º 3
0
string ConfigurationManager::getTempFileLocation(){
    XML xml;
    return xml.getValue(xml.N_TMPFILE);
}
Ejemplo n.º 4
0
string ConfigurationManager::getAllUserFileLocation(){
    XML xml;
    return xml.getValue(xml.N_ALLUSRDIR);
}
Ejemplo n.º 5
0
int ConfigurationManager::getBlockSize(){
    XML xml;
    return atoi(xml.getValue(xml.N_WINDOW).c_str());
}