Do not detect directories ending in ".lnk" as link files.
Task-number: QTBUG-21863 Change-Id: I70b661fa5fcaba1293a80c971c506798826f5b23 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>bb10
parent
aea68c93ae
commit
1022c3ce9d
|
|
@ -822,6 +822,8 @@ bool QFileSystemEngine::fillMetaData(HANDLE fHandle, QFileSystemMetaData &data,
|
|||
return data.hasFlags(what);
|
||||
}
|
||||
|
||||
static bool isDirPath(const QString &dirPath, bool *existed);
|
||||
|
||||
//static
|
||||
bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data,
|
||||
QFileSystemMetaData::MetaDataFlags what)
|
||||
|
|
@ -831,7 +833,10 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
|
|||
|
||||
QFileSystemEntry fname;
|
||||
data.knownFlagsMask |= QFileSystemMetaData::WinLnkType;
|
||||
if(entry.filePath().endsWith(QLatin1String(".lnk"))) {
|
||||
// Check for ".lnk": Directories named ".lnk" should be skipped, corrupted
|
||||
// link files should still be detected as links.
|
||||
const QString origFilePath = entry.filePath();
|
||||
if (origFilePath.endsWith(QLatin1String(".lnk")) && !isDirPath(origFilePath, 0)) {
|
||||
data.entryFlags |= QFileSystemMetaData::WinLnkType;
|
||||
fname = QFileSystemEntry(readLink(entry));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1467,6 +1467,13 @@ void tst_QFileInfo::brokenShortcut()
|
|||
QVERIFY(info.isSymLink());
|
||||
QVERIFY(!info.exists());
|
||||
QFile::remove(linkName);
|
||||
|
||||
QDir current; // QTBUG-21863
|
||||
QVERIFY(current.mkdir(linkName));
|
||||
QFileInfo dirInfo(linkName);
|
||||
QVERIFY(!dirInfo.isSymLink());
|
||||
QVERIFY(dirInfo.isDir());
|
||||
current.rmdir(linkName);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue