Changeset 375
- Timestamp:
- Dec 3, 2009, 9:41:12 PM (15 years ago)
- Location:
- trunk/src/corelib/io
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/io/qfsfileengine.cpp
r172 r375 106 106 is_sequential = 0; 107 107 tried_stat = 0; 108 #if def Q_OS_UNIX108 #if 109 109 need_lstat = 1; 110 110 is_link = 0; 111 112 113 111 114 #endif 112 115 openMode = QIODevice::NotOpen; -
trunk/src/corelib/io/qfsfileengine_os2.cpp
r367 r375 166 166 } 167 167 168 169 170 171 172 173 174 175 168 176 /*! 169 177 \internal … … 617 625 { 618 626 if (tried_stat == 0) { 619 QFSFileEnginePrivate *that = const_cast<QFSFileEnginePrivate*>(this);620 627 if (fh && nativeFilePath.isEmpty()) { 621 628 // ### actually covers two cases: d->fh and when the file is not open 622 that->could_stat = (QT_FSTAT(fileno(fh), &st) == 0);629 could_stat = (QT_FSTAT(fileno(fh), &st) == 0); 623 630 } else if (fd == -1) { 624 631 // ### actually covers two cases: d->fh and when the file is not open 625 that->could_stat = (QT_STAT(nativeFilePath.constData(), &st) == 0); 632 if (isDriveRootPath(filePath)) { 633 // it's a root directory of the drive. Check that the drive is 634 // ready: an attempt to stat() on a removable drive with no 635 // media inserted will cause an unnecessary delay and noise. 636 not_ready = 0; 637 BYTE drv[3] = { filePath.at(0).cell(), ':', '\0' }; 638 BYTE buf[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0}; 639 ULONG bufSize = sizeof(buf); 640 PFSQBUFFER2 pfsq = (PFSQBUFFER2) buf; 641 APIRET arc = DosQueryFSAttach(drv, 0, FSAIL_QUERYNAME, pfsq, 642 &bufSize); 643 if (arc == ERROR_NOT_READY) { 644 // it must be a removable drive with no media in it 645 memset(&st, 0, sizeof(st)); 646 st.st_mode = S_IFDIR | 0777; 647 not_ready = 1; 648 could_stat = true; 649 } else if (arc != NO_ERROR) { 650 Q_ASSERT(arc == ERROR_INVALID_DRIVE); 651 could_stat = false; 652 } else { 653 could_stat = (QT_STAT(nativeFilePath.constData(), &st) == 0); 654 } 655 } else { 656 could_stat = (QT_STAT(nativeFilePath.constData(), &st) == 0); 657 } 626 658 } else { 627 that->could_stat = (QT_FSTAT(fd, &st) == 0);628 } 629 that->tried_stat = 1;659 could_stat = (QT_FSTAT(fd, &st) == 0); 660 } 661 tried_stat = 1; 630 662 } 631 663 return could_stat; … … 700 732 if (exists) 701 733 ret |= ExistsFlag; 702 if ( fileName(BaseName)[0] == QLatin1Char('.'))734 if () 703 735 ret |= HiddenFlag; 704 if ( d->filePath == QLatin1String("/"))736 if ()) 705 737 ret |= RootFlag; 706 738 } … … 963 995 Q_D(const QFSFileEngine); 964 996 QDateTime ret; 965 if (d->doStat() ) {997 if (d->doStat()) { 966 998 if (time == CreationTime) 967 999 ret.setTime_t(d->st.st_ctime ? d->st.st_ctime : d->st.st_mtime); -
trunk/src/corelib/io/qfsfileengine_p.h
r18 r375 143 143 mutable uint is_link : 1; 144 144 #endif 145 146 147 145 148 bool doStat() const; 146 149 bool isSymlink() const;
Note:
See TracChangeset
for help on using the changeset viewer.