2022-07-29 11:22:53 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2022, KylinSoft Co., Ltd.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Authors: iaom <zhangpengfei@kylinos.cn>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "file-system-watcher-private.h"
|
|
|
|
#include <sys/inotify.h>
|
|
|
|
#include <sys/ioctl.h>
|
2023-04-19 10:31:51 +08:00
|
|
|
#include <unistd.h>
|
2022-07-29 11:22:53 +08:00
|
|
|
#include <fcntl.h>
|
2024-05-06 18:03:16 +08:00
|
|
|
#include <cerrno>
|
2022-07-29 11:22:53 +08:00
|
|
|
#include <QDir>
|
|
|
|
#include <QQueue>
|
|
|
|
#include <QtConcurrentRun>
|
|
|
|
|
|
|
|
#include "ukui-search-qdbus.h"
|
|
|
|
#include "file-utils.h"
|
|
|
|
using namespace UkuiSearch;
|
|
|
|
FileSystemWatcherPrivate::FileSystemWatcherPrivate(FileSystemWatcher *parent) : q(parent)
|
|
|
|
{
|
|
|
|
qDebug() << "setInotifyMaxUserWatches start";
|
|
|
|
UkuiSearchQDBus usQDBus;
|
|
|
|
usQDBus.setInotifyMaxUserWatches();
|
|
|
|
qDebug() << "setInotifyMaxUserWatches end";
|
|
|
|
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
FileSystemWatcherPrivate::~FileSystemWatcherPrivate()
|
|
|
|
{
|
2022-10-26 18:01:40 +08:00
|
|
|
close(m_inotifyFd);
|
2022-07-29 11:22:53 +08:00
|
|
|
if(m_notifier) {
|
|
|
|
delete m_notifier;
|
|
|
|
m_notifier = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FileSystemWatcherPrivate::addWatch(const QString &path)
|
|
|
|
{
|
|
|
|
int wd = inotify_add_watch(m_inotifyFd, path.toStdString().c_str(), m_watchEvents | m_watchFlags);
|
|
|
|
if(wd > 0) {
|
|
|
|
m_watchPathHash[wd] = path;
|
|
|
|
} else {
|
|
|
|
qWarning() << "AddWatch error:" << path << strerror(errno);
|
|
|
|
if (errno == ENOSPC) {
|
|
|
|
qWarning() << "User limit reached. Count: " << m_watchPathHash.count();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-26 18:01:40 +08:00
|
|
|
void FileSystemWatcherPrivate::addWatchWithBlackList(const QStringList &pathList, const QStringList &blackList)
|
|
|
|
{
|
|
|
|
QQueue<QString> bfs;
|
|
|
|
QStringList tmpPathList = pathList;
|
|
|
|
for(QString blackPath : blackList) {
|
|
|
|
for(QString path : pathList) {
|
|
|
|
if(FileUtils::isOrUnder(path, blackPath)) {
|
|
|
|
tmpPathList.removeOne(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for(QString path : tmpPathList) {
|
2023-02-24 19:14:24 +08:00
|
|
|
if(!m_watchedRootPaths.contains(path)) {
|
|
|
|
addWatch(path);
|
|
|
|
bfs.enqueue(path);
|
|
|
|
m_watchedRootPaths.append(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!m_recursive) {
|
|
|
|
return;
|
2022-10-26 18:01:40 +08:00
|
|
|
}
|
|
|
|
QFileInfoList list;
|
|
|
|
QDir dir;
|
|
|
|
QStringList tmpList = blackList;
|
|
|
|
dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
|
|
|
|
while(!bfs.empty()) {
|
|
|
|
dir.setPath(bfs.dequeue());
|
|
|
|
list = dir.entryInfoList();
|
|
|
|
for(auto i : list) {
|
|
|
|
bool isBlocked = false;
|
|
|
|
for(QString path : tmpList) {
|
|
|
|
if(i.absoluteFilePath() == path) {
|
|
|
|
isBlocked = true;
|
|
|
|
tmpList.removeOne(path);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(isBlocked)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(!(i.isSymLink())) {
|
|
|
|
addWatch(i.absoluteFilePath());
|
|
|
|
bfs.enqueue(i.absoluteFilePath());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
QStringList FileSystemWatcherPrivate::removeWatch(const QString &path)
|
|
|
|
{
|
|
|
|
QStringList paths;
|
2022-12-08 10:34:29 +08:00
|
|
|
QHash<int, QString>::iterator iter = m_watchPathHash.begin();
|
|
|
|
while(iter != m_watchPathHash.end()) {
|
|
|
|
if(iter.value().length() >= path.length() && FileUtils::isOrUnder(iter.value(), path)) {
|
|
|
|
paths.append(iter.value());
|
|
|
|
inotify_rm_watch(m_inotifyFd, iter.key());
|
|
|
|
iter = m_watchPathHash.erase(iter);
|
|
|
|
} else {
|
|
|
|
++iter;
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
}
|
2022-12-08 10:34:29 +08:00
|
|
|
m_watchPathHash.squeeze();
|
2022-07-29 11:22:53 +08:00
|
|
|
return paths;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString FileSystemWatcherPrivate::removeWatch(int wd)
|
|
|
|
{
|
|
|
|
inotify_rm_watch(m_inotifyFd, wd);
|
|
|
|
return m_watchPathHash.take(wd);
|
|
|
|
}
|
|
|
|
|
2022-10-26 18:01:40 +08:00
|
|
|
void FileSystemWatcherPrivate::clearAll()
|
|
|
|
{
|
|
|
|
if(m_inotifyFd > 0) {
|
|
|
|
close(m_inotifyFd);
|
|
|
|
m_inotifyFd = -1;
|
|
|
|
}
|
|
|
|
if(m_notifier) {
|
|
|
|
delete m_notifier;
|
|
|
|
m_notifier = nullptr;
|
|
|
|
}
|
|
|
|
m_watchPathHash.clear();
|
2023-07-28 10:47:38 +08:00
|
|
|
m_watchedRootPaths.clear();
|
2022-10-26 18:01:40 +08:00
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
2022-07-29 11:22:53 +08:00
|
|
|
void FileSystemWatcherPrivate::init()
|
|
|
|
{
|
|
|
|
if(m_inotifyFd < 0) {
|
|
|
|
m_inotifyFd = inotify_init();
|
|
|
|
|
|
|
|
if (m_inotifyFd > 0) {
|
|
|
|
qDebug()<<"Inotify init success!";
|
|
|
|
} else {
|
|
|
|
qWarning() << "Inotify init fail! Now try add inotify_user_instances.";
|
|
|
|
UkuiSearchQDBus usQDBus;
|
|
|
|
usQDBus.addInotifyUserInstances(128);
|
|
|
|
m_inotifyFd = inotify_init();
|
|
|
|
if (m_inotifyFd > 0) {
|
|
|
|
qDebug()<<"Inotify init success!";
|
|
|
|
} else {
|
|
|
|
printf("errno=%d\n",errno);
|
|
|
|
printf("Mesg:%s\n",strerror(errno));
|
|
|
|
Q_ASSERT_X(0, "InotifyWatch", "Failed to initialize inotify");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fcntl(m_inotifyFd, F_SETFD, FD_CLOEXEC);
|
|
|
|
m_notifier = new QSocketNotifier(m_inotifyFd, QSocketNotifier::Read);
|
|
|
|
QObject::connect(m_notifier, &QSocketNotifier::activated, q, &FileSystemWatcher::eventProcess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-05 14:07:24 +08:00
|
|
|
FileSystemWatcher::FileSystemWatcher(bool recursive, WatchEvents events, WatchFlags flags, QObject *parent)
|
2022-07-29 11:22:53 +08:00
|
|
|
: QObject(parent)
|
|
|
|
, d(new FileSystemWatcherPrivate(this))
|
|
|
|
{
|
|
|
|
d->m_watchEvents = events;
|
|
|
|
d->m_watchFlags = flags;
|
2022-08-05 14:07:24 +08:00
|
|
|
d->m_recursive = recursive;
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
FileSystemWatcher::~FileSystemWatcher()
|
|
|
|
{
|
|
|
|
if(d) {
|
|
|
|
delete d;
|
|
|
|
d = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FileSystemWatcher::addWatch(const QStringList &pathList)
|
|
|
|
{
|
2023-02-24 19:14:24 +08:00
|
|
|
d->addWatchWithBlackList(pathList, QStringList());
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void FileSystemWatcher::addWatch(const QString &path)
|
|
|
|
{
|
2023-02-24 19:14:24 +08:00
|
|
|
d->addWatchWithBlackList(QStringList(path), QStringList());
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
|
2022-10-26 18:01:40 +08:00
|
|
|
void FileSystemWatcher::addWatchWithBlackList(const QStringList &pathList, const QStringList &blackList)
|
|
|
|
{
|
|
|
|
d->addWatchWithBlackList(pathList, blackList);
|
|
|
|
}
|
|
|
|
|
2022-07-29 11:22:53 +08:00
|
|
|
QStringList FileSystemWatcher::removeWatch(const QString &path)
|
|
|
|
{
|
2023-02-24 19:14:24 +08:00
|
|
|
for(QString watchedPath : d->m_watchedRootPaths) {
|
|
|
|
if(FileUtils::isOrUnder(watchedPath, path)) {
|
|
|
|
d->m_watchedRootPaths.removeAll(watchedPath);
|
|
|
|
}
|
|
|
|
}
|
2023-02-28 15:04:30 +08:00
|
|
|
return d->removeWatch(path);
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
|
2022-10-26 18:01:40 +08:00
|
|
|
void FileSystemWatcher::clearAll()
|
|
|
|
{
|
|
|
|
d->clearAll();
|
|
|
|
}
|
|
|
|
|
2022-07-29 11:22:53 +08:00
|
|
|
void FileSystemWatcher::eventProcess(int socket)
|
|
|
|
{
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << "-----begin event process-----";
|
2022-07-29 11:22:53 +08:00
|
|
|
int avail;
|
|
|
|
if (ioctl(socket, FIONREAD, &avail) == EINVAL) {
|
|
|
|
qWarning() << "Did not receive an entire inotify event.";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
char* buf = (char*)malloc(avail);
|
|
|
|
memset(buf, 0x00, avail);
|
|
|
|
|
|
|
|
const ssize_t len = read(socket, buf, avail);
|
|
|
|
|
|
|
|
if(len != avail) {
|
|
|
|
qWarning()<<"read event error";
|
|
|
|
}
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
while (i < len) {
|
|
|
|
const struct inotify_event* event = (struct inotify_event*)&buf[i];
|
|
|
|
|
|
|
|
if(event->name[0] == '.') {
|
2022-08-08 13:55:51 +08:00
|
|
|
i += sizeof(struct inotify_event) + event->len;
|
2022-07-29 11:22:53 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (event->wd < 0 && (event->mask & EventQueueOverflow)) {
|
|
|
|
qWarning() << "Inotify Event queued overflowed";
|
|
|
|
free(buf);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-24 19:14:24 +08:00
|
|
|
// qDebug() << "event mask:" << event->mask
|
|
|
|
// << "isDir:" << (event->mask & IN_ISDIR)
|
|
|
|
// << "event->wd:" << event->wd
|
|
|
|
// << "event->name" << QString(QByteArray::fromRawData(event->name, qstrnlen(event->name, event->len)))
|
|
|
|
// << "event->len" << event->len
|
|
|
|
// << "event->cookie" << event->cookie
|
|
|
|
// << "path:" << d->m_watchPathHash.value(event->wd);
|
2022-07-29 11:22:53 +08:00
|
|
|
QString path;
|
|
|
|
|
2023-02-24 19:14:24 +08:00
|
|
|
if (event->mask & (EventDeleteSelf | EventMoveSelf | EventUnmount)) {
|
2022-07-29 11:22:53 +08:00
|
|
|
path = d->m_watchPathHash.value(event->wd);
|
2023-02-24 19:14:24 +08:00
|
|
|
if(path.isEmpty()) {
|
|
|
|
i += sizeof(struct inotify_event) + event->len;
|
|
|
|
continue;
|
|
|
|
}
|
2022-07-29 11:22:53 +08:00
|
|
|
} else {
|
2023-02-24 19:14:24 +08:00
|
|
|
QByteArray name = QByteArray::fromRawData(event->name, qstrnlen(event->name, event->len));
|
|
|
|
path = d->m_watchPathHash[event->wd];
|
|
|
|
if(name.isEmpty() || path.isEmpty()) {
|
|
|
|
i += sizeof(struct inotify_event) + event->len;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
path.append("/").append(name);
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if(event->mask & EventCreate) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventCreate";
|
2022-07-29 11:22:53 +08:00
|
|
|
Q_EMIT created(path, event->mask & IN_ISDIR);
|
2023-02-24 19:14:24 +08:00
|
|
|
if(event->mask & IN_ISDIR) {
|
|
|
|
for(const QString &createdPath : traverse(path)) {
|
|
|
|
Q_EMIT created(createdPath, QFileInfo(createdPath).isDir());
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (event->mask & EventDeleteSelf) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventDeleteSelf";
|
2023-02-24 19:14:24 +08:00
|
|
|
if(d->m_watchedRootPaths.contains(path)) {
|
|
|
|
// qDebug() << "EventDeleteSelf send" << path;
|
|
|
|
//All folders under this one should be deleted.
|
|
|
|
for(const QString &removedPath : d->removeWatch(path)) {
|
|
|
|
Q_EMIT deleted(removedPath, true);
|
|
|
|
}
|
|
|
|
d->m_watchedRootPaths.removeAll(path);
|
2022-10-26 18:01:40 +08:00
|
|
|
}
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
if (event->mask & EventDelete) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventDelete";
|
2023-02-24 19:14:24 +08:00
|
|
|
if (event->mask & IN_ISDIR) {
|
|
|
|
for(const QString &removedPath : d->removeWatch(path)) {
|
|
|
|
Q_EMIT deleted(removedPath, true);
|
|
|
|
}
|
|
|
|
} else {
|
2022-07-29 11:22:53 +08:00
|
|
|
Q_EMIT deleted(path, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (event->mask & EventModify) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventModify";
|
2023-04-19 15:14:36 +08:00
|
|
|
if(!(event->mask & IN_ISDIR)) {
|
2023-02-24 19:14:24 +08:00
|
|
|
Q_EMIT modified(path);
|
|
|
|
}
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
if (event->mask & EventMoveSelf) {
|
2023-02-24 19:14:24 +08:00
|
|
|
// qDebug() << path << "--EventMoveSelf";
|
|
|
|
if(d->m_watchedRootPaths.contains(path)) {
|
|
|
|
for(const QString &removedPath : d->removeWatch(path)) {
|
|
|
|
Q_EMIT moved(removedPath, true);
|
|
|
|
}
|
|
|
|
d->m_watchedRootPaths.removeAll(path);
|
|
|
|
}
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
if (event->mask & EventMoveFrom) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventMoveFrom";
|
2023-02-24 19:14:24 +08:00
|
|
|
if (event->mask & IN_ISDIR) {
|
|
|
|
for(const QString &removedPath : d->removeWatch(path)) {
|
|
|
|
Q_EMIT moved(removedPath, true);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Q_EMIT moved(path, false);
|
|
|
|
}
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
if (event->mask & EventMoveTo) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventMoveTo";
|
2023-02-24 19:14:24 +08:00
|
|
|
Q_EMIT moveTo(path, event->mask & IN_ISDIR);
|
|
|
|
if (event->mask & IN_ISDIR) {
|
|
|
|
for(const QString &createdPath : traverse(path)) {
|
|
|
|
Q_EMIT moveTo(createdPath, QFileInfo(createdPath).isDir());
|
2022-08-05 14:07:24 +08:00
|
|
|
}
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (event->mask & EventOpen) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventOpen";
|
2022-07-29 11:22:53 +08:00
|
|
|
Q_EMIT opened(path);
|
|
|
|
}
|
|
|
|
if (event->mask & EventUnmount) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventUnmount";
|
2022-07-29 11:22:53 +08:00
|
|
|
// This is present because a unmount event is sent by inotify after unmounting, by
|
|
|
|
// which time the watches have already been removed.
|
|
|
|
if (path != "/") {
|
2022-12-23 11:11:06 +08:00
|
|
|
Q_EMIT unmounted(path, event->mask & IN_ISDIR);
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
2023-02-24 19:14:24 +08:00
|
|
|
d->m_watchedRootPaths.removeAll(path);
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
if (event->mask & EventAttributeChange) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventAttributeChange";
|
2022-07-29 11:22:53 +08:00
|
|
|
Q_EMIT attributeChanged(path);
|
2024-05-06 18:03:16 +08:00
|
|
|
if (event->mask & IN_ISDIR) {
|
|
|
|
QFileInfo info(path);
|
|
|
|
if(!info.isReadable() || !info.isExecutable()) {
|
|
|
|
for(const QString &removedPath : d->removeWatch(path)) {
|
|
|
|
Q_EMIT accessibleChanged(removedPath, true, false);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!d->m_watchPathHash.values().contains(path)) {
|
|
|
|
for(const QString &createdPath : traverse(path)) {
|
|
|
|
Q_EMIT accessibleChanged(createdPath, QFileInfo(createdPath).isDir(), true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Q_EMIT accessibleChanged(path, false, QFileInfo(path).isReadable());
|
|
|
|
}
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
if (event->mask & EventAccess) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventAccess";
|
2022-07-29 11:22:53 +08:00
|
|
|
Q_EMIT accessed(path);
|
|
|
|
}
|
|
|
|
if (event->mask & EventCloseWrite) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventCloseWrite";
|
2022-07-29 11:22:53 +08:00
|
|
|
Q_EMIT closedWrite(path);
|
|
|
|
}
|
|
|
|
if (event->mask & EventCloseRead) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventCloseRead";
|
2022-07-29 11:22:53 +08:00
|
|
|
Q_EMIT closedRead(path);
|
|
|
|
}
|
|
|
|
if (event->mask & EventIgnored) {
|
2022-10-26 18:01:40 +08:00
|
|
|
// qDebug() << path << "--EventIgnored";
|
2022-07-29 11:22:53 +08:00
|
|
|
}
|
|
|
|
i += sizeof(struct inotify_event) + event->len;
|
|
|
|
}
|
|
|
|
if (len < 0) {
|
|
|
|
qWarning() << "Failed to read event.";
|
|
|
|
}
|
|
|
|
|
|
|
|
free(buf);
|
|
|
|
}
|
2023-02-24 19:14:24 +08:00
|
|
|
QStringList FileSystemWatcher::traverse(QString &path)
|
|
|
|
{
|
|
|
|
QStringList paths;
|
|
|
|
d->addWatch(path);
|
|
|
|
if(!d->m_recursive || QFileInfo(path).isSymLink()) {
|
|
|
|
return paths;
|
|
|
|
}
|
|
|
|
QQueue<QString> queue;
|
|
|
|
queue.enqueue(path);
|
|
|
|
|
|
|
|
QFileInfoList list;
|
|
|
|
QDir dir;
|
|
|
|
dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
|
|
|
dir.setSorting(QDir::DirsFirst);
|
|
|
|
while(!queue.empty()) {
|
|
|
|
dir.setPath(queue.dequeue());
|
|
|
|
list = dir.entryInfoList();
|
|
|
|
for(auto i : list) {
|
|
|
|
if(i.isDir() && !(i.isSymLink())) {
|
|
|
|
queue.enqueue(i.absoluteFilePath());
|
|
|
|
d->addWatch(i.absoluteFilePath());
|
|
|
|
}
|
|
|
|
paths.append(i.absoluteFilePath());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return paths;
|
|
|
|
}
|