From 7fafa8adfb66790c7e357f6afd50902616323bad Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 5 Mar 2023 01:23:28 +0100 Subject: [PATCH] QtFSListener: Log watcher errors --- src/core/qtfslistener.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/core/qtfslistener.cpp b/src/core/qtfslistener.cpp index f09936861..22bdfe911 100644 --- a/src/core/qtfslistener.cpp +++ b/src/core/qtfslistener.cpp @@ -23,6 +23,7 @@ #include #include +#include "core/logging.h" #include "filesystemwatcherinterface.h" #include "qtfslistener.h" @@ -32,11 +33,25 @@ QtFSListener::QtFSListener(QObject *parent) : FileSystemWatcherInterface(parent) } -void QtFSListener::AddPath(const QString &path) { watcher_.addPath(path); } +void QtFSListener::AddPath(const QString &path) { -void QtFSListener::RemovePath(const QString &path) { watcher_.removePath(path); } + if (!watcher_.addPath(path)) { + qLog(Error) << "Failed to add watch for path" << path; + } + +} + +void QtFSListener::RemovePath(const QString &path) { + + if (!watcher_.removePath(path)) { + qLog(Error) << "Failed to remove watch for path" << path; + } + +} void QtFSListener::Clear() { + watcher_.removePaths(watcher_.directories()); watcher_.removePaths(watcher_.files()); + }