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

Method recursiveScanRootDirectory

common/sqlitedb.cpp:322–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322int SQLiteDB::recursiveScanRootDirectory(const QString &base_path, const QString &rel_path, int parent_ohfi, int root_ohfi)
323{
324 int total_objects = 0;
325
326 QDir dir(base_path + "/" + rel_path);
327 dir.setSorting(QDir::Name);
328 QFileInfoList qsl = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
329
330 foreach(const QFileInfo &info, qsl) {
331
332 if(!continueOperation()) {
333 return -1;
334 }
335
336 //qDebug() << "Processing " << info.fileName();
337
338 QString rel_name = rel_path.isNull() ? info.fileName() : rel_path + "/" + info.fileName();
339
340 int ohfi = insertObjectEntryInternal(base_path, rel_name, parent_ohfi, root_ohfi);
341
342 if(ohfi > 0) {
343 // update progress dialog
344 if(info.isDir()) {
345 emit directoryAdded(base_path + "/" + rel_name);
346 int inserted = recursiveScanRootDirectory(base_path, rel_name, ohfi, root_ohfi);
347 if(inserted < 0) {
348 return -1;
349 }
350
351 total_objects += inserted;
352 qint64 dirsize = getChildenTotalSize(ohfi);
353 setObjectSize(ohfi, dirsize);
354 } else if(info.isFile()) {
355 emit fileAdded(info.fileName());
356 total_objects++;
357 }
358 }
359 }
360
361 return total_objects;
362}
363
364int SQLiteDB::insertObjectEntry(const QString &path, const QString &name, int parent_ohfi)
365{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected