[Interest] QFileSystemWatcher - possible bug

Graham Labdon Graham.Labdon at avalonsciences.com
Thu Dec 12 15:52:41 CET 2013


Hi
I have added a path to a QFileSystemWatcher object to detect when a folder is added to an initial folder.
I have connected the directoryChanged signal and indeed this gets called when a folder is added to the initial folder.
now want to add a watch for the added folder so in my slot I get a list of folders in the initial folder -

                              QDir rootDir(m_rootFolderPathname);
                              QFileInfoList listing = rootDir.entryInfoList(QDir::Dirs,QDir::Name);

and add the last entry as a slot

m_fileSystemWatcher->addPath(listing.last().absoluteFilePath());


I have tested this under various circumstances and the add path sometimes fails. In particular, if I use windows explorer to copy an (empty) folder into to initial folder it will always fail even though the QFileInfoList says that the folder exists.
Running the program through the debugger - it never fails

If I set the initial folder to point at a folder on a neworked drive of a pen drive the call to addPath never fails.
If a use another program to copy a folder into the initial folder, once again everything is as expected.

I am guessing that QFileSystemWatcher does not find the new folder for some reason, even though QDir does find it.

Is this a bug or just an operating system issue?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131212/92c9d645/attachment.html>


More information about the Interest mailing list