Results 1 to 6 of 6

Thread: [QDir] impossible to list files.

  1. #1

    Default [QDir] impossible to list files.

    Hi, I want to browse directories to find files, so, I've tried something like this :

    Qt Code:
    1. QDir dir(path);
    2. QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
    3. foreach(QFileInfo finfo, list) {
    4. if (finfo.isDir()) {
    5. findFileFromCurrentDirectory(finfo.absoluteFilePath());
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 

    But the program has just been terminated sundenly.

    Thanks. (I'm on linux)

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QDir] impossible to list files.

    I'm guessing that this code is from function findFileFromCurrentDirectory. If so, you have a recurrence which can cause a stack overflow.

  3. #3

    Default Re: [QDir] impossible to list files.

    I'm guessing that this code is from function findFileFromCurrentDirectory. If so, you have a recurrence which can cause a stack overflow.
    Stack overflow which only one recurrence call.

    It only output the first dir name, and then it crash.

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QDir] impossible to list files.

    So use this cool tool called "debugger".

  5. #5

    Default Re: [QDir] impossible to list files.

    I've solved the issue, thanks.

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: [QDir] impossible to list files.

    I've solved the issue, thanks.
    Well, keep it a secret so others can struggle with it too.

    This forum isn't a one-way street, you know.

Similar Threads

  1. QDir, list all directories?
    By hakermania in forum Newbie
    Replies: 10
    Last Post: 1st July 2015, 05:41
  2. QDir::setCurrent with resource files
    By LarryERamey in forum Qt Programming
    Replies: 3
    Last Post: 20th April 2011, 02:21
  3. QDir::NoDotAndDotDot hidding all files?
    By been_1990 in forum Qt Programming
    Replies: 2
    Last Post: 3rd July 2009, 03:12
  4. how to list out all files in a dir and sub dir
    By rajesh in forum Qt Programming
    Replies: 5
    Last Post: 14th August 2006, 14:57
  5. Qt4: QDir::entryList bug in windows when listing network files?
    By Yvon Halbwachs in forum Qt Programming
    Replies: 2
    Last Post: 12th May 2006, 14:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.