QFileSystemWatcher - possible bug?



  • 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.
    I 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?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.