return _isReliable;
}
+void FolderWatcher::appendSubPaths(QDir dir, QStringList& subPaths) {
+ QStringList newSubPaths = dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files);
+ for (int i = 0; i < newSubPaths.size(); i++) {
+ QString path = dir.path() + "/" + newSubPaths[i];
+ QFileInfo fileInfo(path);
+ subPaths.append(path);
+ if (fileInfo.isDir()) {
+ QDir dir(path);
+ appendSubPaths(dir, subPaths);
+ }
+ }
+}
+
void FolderWatcher::changeDetected(const QString &path)
{
+ QFileInfo fileInfo(path);
QStringList paths(path);
+ if (fileInfo.isDir()) {
+ QDir dir(path);
+ appendSubPaths(dir, paths);
+ }
changeDetected(paths);
}
#include <QHash>
#include <QScopedPointer>
#include <QSet>
+#include <QDir>
class QTimer;
Folder *_folder;
bool _isReliable = true;
+ void appendSubPaths(QDir dir, QStringList& subPaths);
+
friend class FolderWatcherPrivate;
};
}
QVERIFY(waitForPathChanged(file));
}
+ void testMove3LevelDirWithFile() {
+ QString file(_rootPath + "/a0/b/c/empty.txt");
+ mkdir(_rootPath + "/a0");
+ mkdir(_rootPath + "/a0/b");
+ mkdir(_rootPath + "/a0/b/c");
+ touch(file);
+ QString cmd = QString("mv " + _rootPath + "/a0 " + _rootPath + "/a");
+ qDebug() << "Command: " << cmd;
+ system(cmd.toLocal8Bit());
+ QVERIFY(waitForPathChanged(_rootPath + "/a/b/c/empty.txt"));
+ }
+
+
void testCreateADir() {
QString file(_rootPath+"/a1/b1/new_dir");
mkdir(file);