diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2010-09-10 12:17:12 (GMT) |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2010-09-10 12:17:12 (GMT) |
commit | 529aa7d39f8eab70a954f02ac1ac5a6bac9889bb (patch) | |
tree | 5409aba6c4cd8fc52ea984f61188c2ff6cea6967 | |
parent | 4506d57fc0320234efcd4ab39e2fe9c2810b4d3c (diff) | |
download | Qt-529aa7d39f8eab70a954f02ac1ac5a6bac9889bb.zip Qt-529aa7d39f8eab70a954f02ac1ac5a6bac9889bb.tar.gz Qt-529aa7d39f8eab70a954f02ac1ac5a6bac9889bb.tar.bz2 |
Fix QFileInfo::isHidden on Mac
Having HiddenAttribute as part of PosixStatFlags, meant that we would
assume we knew about it whenever we stat'ed, which wasn't the intent. As
that is just one of the queries we do on Mac OS to determine if a file
is considered hidden.
Instead, we explicitly ask for a stat anytime the attribute is queried
for.
The proper fix will be to perform the cheap operations (e.g., file name
begins with '.') first and only stat if we still haven't got an answer.
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 7 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemmetadata_p.h | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 65cb42f..eb6b9f1 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -300,6 +300,13 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM } #endif +#if !defined(QWS) && defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + if (what & QFileSystemMetaData::HiddenAttribute) { + // Mac OS >= 10.5: st_flags & UF_HIDDEN + what |= QFileSystemMetaData::PosixStatFlags; + } +#endif + if (what & QFileSystemMetaData::PosixStatFlags) what |= QFileSystemMetaData::PosixStatFlags; diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index 9df762c..c34cc1e 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -145,10 +145,6 @@ struct QFileSystemMetaData | QFileSystemMetaData::FileType | QFileSystemMetaData::DirectoryType | QFileSystemMetaData::SequentialType -#if !defined(QWS) && defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - // Mac OS >= 10.5: st_flags & UF_HIDDEN - | QFileSystemMetaData::HiddenAttribute -#endif | QFileSystemMetaData::SizeAttribute | QFileSystemMetaData::Times | QFileSystemMetaData::OwnerIds, |