// 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; }
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(); }
string ConfigurationManager::getTempFileLocation(){ XML xml; return xml.getValue(xml.N_TMPFILE); }
string ConfigurationManager::getAllUserFileLocation(){ XML xml; return xml.getValue(xml.N_ALLUSRDIR); }
int ConfigurationManager::getBlockSize(){ XML xml; return atoi(xml.getValue(xml.N_WINDOW).c_str()); }