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 - possible bug?
QtWS25 Last Chance

QFileSystemWatcher - possible bug?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 651 Views
  • 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.
  • G Offline
    G Offline
    GrahamL
    wrote on last edited by
    #1

    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?

    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