MCPcopy Create free account
hub / github.com/codestation/qcma / recursiveScanRootDirectory

Method recursiveScanRootDirectory

common/qlistdb.cpp:246–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246int QListDB::recursiveScanRootDirectory(root_list &list, CMAObject *obj_parent, int ohfi_type)
247{
248 int obj_file_type = -1;
249 int total_objects = 0;
250
251 QDir dir(obj_parent->m_path);
252 dir.setSorting(QDir::Name | QDir::DirsFirst);
253 QFileInfoList qsl = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot, QDir::Time);
254
255 if(obj_parent && !obj_parent->parent) {
256 std::sort(qsl.begin(), qsl.end(), nameLessThan);
257 }
258
259 foreach(const QFileInfo &info, qsl) {
260
261 if(!continueOperation()) {
262 return -1;
263 }
264
265 if(info.isFile() && (obj_file_type = checkFileType(info.absoluteFilePath(), ohfi_type)) < 0) {
266 //qDebug("Excluding %s from database", info.absoluteFilePath().toStdString().c_str());>
267 } else {
268 CMAObject *obj = new CMAObject(obj_parent);
269 obj->initObject(info, obj_file_type);
270 emit fileAdded(obj->metadata.name);
271 //qDebug("Added %s to database with OHFI %d", obj->metadata.name, obj->metadata.ohfi);
272 list << obj;
273 if(info.isDir()) {
274 emit directoryAdded(obj->m_path);
275 total_objects += recursiveScanRootDirectory(list, obj, ohfi_type);
276 } else {
277 total_objects++;
278 }
279 }
280 }
281
282 return total_objects;
283}
284
285bool QListDB::removeInternal(root_list &list, int ohfi)
286{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected