Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-8945 QFileSystemWatcher should notify when files are modified in a watched directory
  3. QTBUG-6524

Windows: QFileSystemWatcher does not signal directoryChanged() when files are modified in a watched directory

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Invalid
    • Icon: P3: Somewhat important P3: Somewhat important
    • Some future release
    • Core: I/O
    • None
    • Win32 / Building with VS2005 / 32bit / Windows XP

      It does emit the signal when files are added to or removed from the directory. It does not fire the signal when existing files are modified. According to the documentation: http://doc.trolltech.com/4.6/qfilesystemwatcher.html#directoryChanged it should:

      This signal is emitted when the directory at a specified path, is modified (e.g., when a file is added, modified or deleted) or removed from disk.

      This can be fixed by modifying qfilesystemwatcher_win.cpp:QWindowsFileSystemWatcherEngine::addPaths so that the flag

      FILE_NOTIFY_CHANGE_LAST_WRITE
      

      is added to the flags for directories as well as files so that the code becomes:

             uint flags = isDir
                                 ? (FILE_NOTIFY_CHANGE_DIR_NAME
                                    | FILE_NOTIFY_CHANGE_FILE_NAME
                                    | FILE_NOTIFY_CHANGE_LAST_WRITE)
                                 : (FILE_NOTIFY_CHANGE_DIR_NAME
                                    | FILE_NOTIFY_CHANGE_FILE_NAME
                                    | FILE_NOTIFY_CHANGE_ATTRIBUTES
                                    | FILE_NOTIFY_CHANGE_SIZE
                                    | FILE_NOTIFY_CHANGE_LAST_WRITE
                                    | FILE_NOTIFY_CHANGE_SECURITY);
      

      I don't work on the other platforms I can't compare this behaviour to what they do.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            w00t Robin Burchell
            joolsa Julian Adams
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes