summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorRitt Konstantin <ritt.ks@gmail.com>2009-08-11 16:11:27 (GMT)
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-11 16:21:30 (GMT)
commitf36fb8b2b63b3734cc2bd66b329ca4fef1204845 (patch)
tree18f7dd3fa9d7a88abdac58d5ac3afe9773eb80f3 /src/corelib
parent7fe0dfb80efd67886a33fe8b37e9714175925688 (diff)
downloadQt-f36fb8b2b63b3734cc2bd66b329ca4fef1204845.zip
Qt-f36fb8b2b63b3734cc2bd66b329ca4fef1204845.tar.gz
Qt-f36fb8b2b63b3734cc2bd66b329ca4fef1204845.tar.bz2
'.' and '..' must not be hidden
_unix code always sets HiddenFlag for special dirs which is wrong; also there is some inconsistence under win: * FindFirstFile sets FILE_ATTRIBUTE_HIDDEN flag for ".." of hidden dir *even* if parent dir is not hidden; * GetFileAttributes sets FILE_ATTRIBUTE_HIDDEN flag for ".." *only* if parent dir is hidden. so, _win part sets HiddenFlag wrong too; finally, we never test parent dir's flags; futhermore hidden special dirs (dotAndDotDot) makes dir iterator's filtering a bit more complex Merge-request: 1176 Reviewed-by: Joerg Bornemann <joerg.bornemann@trolltech.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp18
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp7
2 files changed, 15 insertions, 10 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 4d451e6..ff10a44 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -656,15 +656,19 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
ret |= LocalDiskFlag;
if (exists)
ret |= ExistsFlag;
- QString baseName = fileName(BaseName);
- if ((baseName.size() > 0 && baseName.at(0) == QLatin1Char('.'))
+ if (d->filePath == QLatin1String("/")) {
+ ret |= RootFlag;
+ } else {
+ QString baseName = fileName(BaseName);
+ if ((baseName.size() > 1
+ && baseName.at(0) == QLatin1Char('.') && baseName.at(1) != QLatin1Char('.'))
#if !defined(QWS) && defined(Q_OS_MAC)
- || _q_isMacHidden(d->filePath)
+ || _q_isMacHidden(d->filePath)
#endif
- )
- ret |= HiddenFlag;
- if (d->filePath == QLatin1String("/"))
- ret |= RootFlag;
+ ) {
+ ret |= HiddenFlag;
+ }
+ }
}
return ret;
}
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 25fbae8..c2b993b 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -1542,12 +1542,13 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(QAbstractFileEngine::Fil
if (type & FlagsMask) {
if(d->doStat()) {
ret |= QAbstractFileEngine::FileFlags(ExistsFlag | LocalDiskFlag);
- if (d->fileAttrib & FILE_ATTRIBUTE_HIDDEN)
- ret |= HiddenFlag;
if (d->filePath == QLatin1String("/") || (d->filePath.at(0).isLetter() && d->filePath.mid(1,d->filePath.length()) == QLatin1String(":/"))
|| isUncRoot(d->filePath)) {
ret |= RootFlag;
- ret &= ~HiddenFlag;
+ } else if (d->fileAttrib & FILE_ATTRIBUTE_HIDDEN) {
+ QString baseName = fileName(BaseName);
+ if (baseName != QLatin1String(".") && baseName != QLatin1String(".."))
+ ret |= HiddenFlag;
}
}
}