-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.cpp
More file actions
26 lines (24 loc) · 789 Bytes
/
utils.cpp
File metadata and controls
26 lines (24 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "utils.h"
#include "defines.h"
#include <QDir>
#include <QDirIterator>
#include <QDebug>
QStringList scanDirItems(QString initialPath, QString extension, QString relativePath)
{
QDir fullDir(initialPath);
QDir dir(relativePath);
QStringList files;
QString fullPath = fullDir.absolutePath();
QString path = dir.absolutePath();
qDebug() << "Search in " << path << LOG_DATA;
QDirIterator iterator(fullPath, QDirIterator::Subdirectories);
while (iterator.hasNext()) {
iterator.next();
if (!iterator.fileInfo().isDir()) {
QString filename = iterator.filePath();
if (filename.endsWith(extension))
files.append(filename.remove(path));
}
}
return files;
}