Results 1 to 2 of 2

Thread: Qt4 configured with -largefile

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Qt4 configured with -largefile

    Hi,

    I am building qt-4.3.2 32-bit with "-largefile" flag, but it does not seems to work.

    I have a large file system. I try the following codes:

    QDir myDir( path )
    QStringList fileList = myDir.entryList();

    It returns fileList.size() = 0, even thought there are several files in the path.

    If I do QFile::exists( path/file ), it will return true.

    As a result, I can't list the files in the directory...so I can't find any file I need...

    If I build 64-bit application, all files can be seen....

    Can someone please tell me what is the problem?

    Thanks

  2. #2
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt4 configured with -largefile

    Case closed.

    It is a Qt bug to use opendir (src/corelib/io/qfsfileengine_iterator_unix.cpp) trying to access directory in large filesystem.

    scandir64 fixes the problem

    Qt Code:
    1. static QStringList getFileList( const char* dirname, const QRegExp& filter )
    2. {
    3. QStringList fileList;
    4.  
    5. struct dirent64 **namelist=NULL;
    6. int sz = scandir64( dirname, &namelist, 0 , alphasort );
    7. for ( int idx=0; idx < sz; idx++ ) {
    8. if ( QString( namelist[idx]->d_name ).contains( filter ) ) {
    9. QString fullpath( dirname );
    10. fullpath += "/";
    11. fullpath += namelist[idx]->d_name;
    12. fileList << fullpath;
    13. }
    14. }
    15.  
    16. if ( sz > 0 ) {
    17. while( sz-- ) {
    18. free( namelist[sz] );
    19. }
    20. free( namelist );
    21. }
    22.  
    23. return fileList;
    24.  
    25. } // getFileList
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QMAKESPEC has not been configured
    By karthik in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 18th November 2007, 17:54

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.