Changeset 612
- Timestamp:
- Feb 27, 2010, 12:21:56 AM (15 years ago)
- Location:
- trunk/src/corelib/io
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/io/qfsfileengine.cpp
r561 r612 114 114 is_link = 0; 115 115 #endif 116 #if defined(Q_OS_OS2)117 not_ready = 0;118 #endif119 116 openMode = QIODevice::NotOpen; 120 117 fd = -1; -
trunk/src/corelib/io/qfsfileengine_os2.cpp
r564 r612 138 138 } 139 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 140 155 static bool isRelativePath(const QString &path) 141 156 { … … 642 657 // ready: an attempt to stat() on a removable drive with no 643 658 // media inserted will cause an unnecessary delay and noise. 644 not_ready = 0;645 659 BYTE drv[3] = { filePath.at(0).cell(), ':', '\0' }; 646 660 BYTE buf[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0}; … … 649 663 APIRET arc = DosQueryFSAttach(drv, 0, FSAIL_QUERYNAME, pfsq, 650 664 &bufSize); 651 if (arc == ERROR_NOT_READY) { 652 // it must be a removable drive with no media in it 653 memset(&st, 0, sizeof(st)); 654 st.st_mode = S_IFDIR | 0777; 655 not_ready = 1; 656 could_stat = true; 657 } else if (arc != NO_ERROR) { 665 if (arc != NO_ERROR) { 658 666 could_stat = false; 659 667 } else { … … 676 684 QFSFileEnginePrivate *that = const_cast<QFSFileEnginePrivate *>(this); 677 685 that->need_lstat = false; 678 QT_STATBUF st; // don't clobber our main one 679 that->is_link = (QT_LSTAT(nativeFilePath.constData(), &st) == 0) ? S_ISLNK(st.st_mode) : false; 686 if (isDriveRootPath(filePath) || isUncRootPath(filePath)) { 687 is_link = false; // drive/share names are never symlinks 688 } else { 689 QT_STATBUF st; // don't clobber our main one 690 that->is_link = (QT_LSTAT(nativeFilePath.constData(), &st) == 0) ? 691 S_ISLNK(st.st_mode) : false; 692 } 680 693 } 681 694 return is_link; … … 688 701 { 689 702 Q_D(const QFSFileEngine); 703 690 704 // Force a stat, so that we're guaranteed to get up-to-date results 691 if (type & QAbstractFileEngine::FileFlag(QAbstractFileEngine::Refresh)) {705 if (type & ) { 692 706 d->tried_stat = 0; 693 707 d->need_lstat = 1; 694 708 } 695 709 710 711 712 696 713 QAbstractFileEngine::FileFlags ret = 0; 697 bool exists = d->doStat(); 698 if (!exists && !d->isSymlink()) 714 715 // flags that don't need doStat() 716 if (type & FlagsMask) { 717 ret |= LocalDiskFlag; 718 if (isRoot) 719 ret |= RootFlag; 720 } 721 if (type & TypesMask) { 722 if (isRoot) 723 ret |= DirectoryType; 724 // note: drive/share names are never symlinks 725 else if ((type & LinkType) && d->isSymlink()) 726 ret |= LinkType; 727 } 728 729 if (!exists) 699 730 return ret; 700 731 701 if (exists && (type & PermsMask)) { 732 // flags that need doStat() 733 if (type & PermsMask) { 702 734 if (d->st.st_mode & S_IRUSR) 703 735 ret |= ReadOwnerPerm; … … 726 758 } 727 759 if (type & TypesMask) { 728 { 729 if ((type & LinkType) && d->isSymlink()) 730 ret |= LinkType; 731 if (exists && (d->st.st_mode & S_IFMT) == S_IFREG) 732 ret |= FileType; 733 else if (exists && (d->st.st_mode & S_IFMT) == S_IFDIR) 734 ret |= DirectoryType; 735 } 760 if ((d->st.st_mode & S_IFMT) == S_IFREG) 761 ret |= FileType; 762 else if ((d->st.st_mode & S_IFMT) == S_IFDIR) 763 ret |= DirectoryType; 736 764 } 737 765 if (type & FlagsMask) { 738 ret |= LocalDiskFlag; 739 if (exists) 740 ret |= ExistsFlag; 766 ret |= ExistsFlag; 741 767 if (d->st.st_attr & FILE_HIDDEN) 742 768 ret |= HiddenFlag; 743 if (isDriveRootPath(d->filePath)) 744 ret |= RootFlag; 745 } 769 } 770 746 771 return ret; 747 772 } … … 1002 1027 Q_D(const QFSFileEngine); 1003 1028 QDateTime ret; 1004 if (d->doStat() && !d->not_ready) {1029 if (d->doStat()) { 1005 1030 if (time == CreationTime) 1006 1031 ret.setTime_t(d->st.st_ctime ? d->st.st_ctime : d->st.st_mtime); -
trunk/src/corelib/io/qfsfileengine_p.h
r561 r612 138 138 mutable uint is_link : 1; 139 139 #endif 140 #if defined(Q_OS_OS2)141 mutable uint not_ready : 1;142 #endif143 140 144 141 bool doStat() const;
Note:
See TracChangeset
for help on using the changeset viewer.