Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileSystemWatcher QDir::remove locking
Forum Updated to NodeBB v4.3 + New Features

QFileSystemWatcher QDir::remove locking

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 5.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mirswith
    wrote on last edited by
    #1

    According to QFileSystemWatcher it will emit it's directoryChanged signal when a path is removed, which it does ... sort of. It emits the signal but the folder is not reporting that it has been removed using QDir::exists. If I try browsing to the folder with windows explorer it shows the directory but gives me an access denied if I try entering it. I'm running Windows 7 x64 btw. To test if QFileSystemWatcher was locking it I put together this quick sample:

    @
    QDir dir("c:/temp");
    qDebug() << "mkpath test1/test2/test3" << dir.mkpath("test1/test2/test3");
    QFileSystemWatcher watch(QStringList() << dir.absoluteFilePath("test1") << dir.absoluteFilePath("test1/test2") << dir.absoluteFilePath("test1/test2/test3"));
    qDebug() << "rmdir - test1/test2/test3" << dir.rmdir("test1/test2/test3");
    qDebug() << "rmdir - test1/test2" << dir.rmdir("test1/test2");
    qDebug() << "rmdir - test1" << dir.rmdir("test1");

    @

    Which outputs...

    @
    mkpath test1/test2/test3 true
    rmdir - test1/test2/test3 true
    QFileSystemWatcher: FindNextChangeNotification failed!! (Access is denied.)
    rmdir - test1/test2 false
    rmdir - test1 false
    @

    If I comment out the QFileSystemWatcher line then all the folders are removed successfully or if I remove the paths from the QFileSystemWatcher before I delete them then it will also succeed. What confuses me is that the docs say "Note that QFileSystemWatcher stops monitoring files once they have been renamed or removed from disk, and directories once they have been removed from disk.". I was hoping to use QFileSystemWatcher to be my notifier when directories were removed, otherwise I have to build my own hooks to notify the "watcher" when things have changed. Any ideas?

    Thanks.

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wizzhard
      wrote on last edited by
      #2

      I am currently using Qt 5.0.2 on Windows 7 64 bits and I am experiencing the same issue.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved