]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Revert "FolderWatcher: Act on relative paths #5116 (#5153)"
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 12 Sep 2016 13:02:54 +0000 (15:02 +0200)
committerOlivier Goffart <ogoffart@woboq.com>
Thu, 15 Sep 2016 14:26:25 +0000 (16:26 +0200)
This is not sufficient as it is not working for the Socket API.
Next commit will fix it in another layer.

Also, not ignoring paths that are not inside the folder is wrong
as it might still happen if the name has a different casing

This reverts commit d5a481f13240b50ff3993184152d3d4145ebfde0.

(cherry picked from commit 904cd46f757bf329b719bd815394ff986be99aaf)

src/gui/folder.cpp
src/gui/folder.h
src/gui/folderwatcher.cpp
src/gui/folderwatcher.h

index 738fe7f11b61e626a65971d393e67c52c787eb79..a4f2e25fac0a6a517541346d1b08f5fbf6ba3711 100644 (file)
@@ -628,6 +628,11 @@ void Folder::removeFromSettings() const
     settings->remove(FolderMan::escapeAlias(_definition.alias));
 }
 
+bool Folder::isFileExcludedAbsolute(const QString& fullPath) const
+{
+    return _engine->excludedFiles().isExcluded(fullPath, path(), _definition.ignoreHiddenFiles);
+}
+
 bool Folder::isFileExcludedRelative(const QString& relativePath) const
 {
     return _engine->excludedFiles().isExcluded(path() + relativePath, path(), _definition.ignoreHiddenFiles);
index bfd4de4d7b775580fd6450e3ebf88e02e9d9ae52..79a27ad623e1f1cdd9040e85031bbce939c9d301 100644 (file)
@@ -183,6 +183,11 @@ public:
      /// Removes the folder from the account's settings.
      void removeFromSettings() const;
 
+     /**
+      * Returns whether a file inside this folder should be excluded.
+      */
+     bool isFileExcludedAbsolute(const QString& fullPath) const;
+
      /**
       * Returns whether a file inside this folder should be excluded.
       */
index c115611bb203fbaa5ecdde064a7996cbd0874b9d..30809c82f59d323c0d800988c03fe08042f019c6 100644 (file)
@@ -41,9 +41,7 @@ FolderWatcher::FolderWatcher(const QString &root, Folder* folder)
     : QObject(folder),
       _folder(folder)
 {
-    _canonicalFolderPath = QFileInfo(root).canonicalFilePath();
-
-    _d.reset(new FolderWatcherPrivate(this, _canonicalFolderPath));
+    _d.reset(new FolderWatcherPrivate(this, root));
 
     _timer.start();
 }
@@ -57,17 +55,10 @@ bool FolderWatcher::pathIsIgnored( const QString& path )
     if( !_folder ) return false;
 
 #ifndef OWNCLOUD_TEST
-    QString relPath = path;
-    if (relPath.startsWith(_canonicalFolderPath)) {
-        relPath = relPath.remove(0, _canonicalFolderPath.length()+1);
-        if (_folder->isFileExcludedRelative(relPath)) {
-            qDebug() << "* Ignoring file" << relPath << "in" << _canonicalFolderPath;
-            return true;
-        }
+    if (_folder->isFileExcludedAbsolute(path)) {
+        qDebug() << "* Ignoring file" << path;
+        return true;
     }
-    // there could be an odd watch event not being inside the _canonicalFolderPath
-    // We will just not ignore it then, who knows.
-
 #endif
     return false;
 }
index 9b0d17471856109bd4baa073ece8535d309244ff..15fe223a4410278d215cd6b563e8dabcc1a7eb66 100644 (file)
@@ -89,7 +89,6 @@ private:
     QTime _timer;
     QSet<QString> _lastPaths;
     Folder* _folder;
-    QString _canonicalFolderPath;
 
     friend class FolderWatcherPrivate;
 };