Distinguish macOS aliases from normal symbolic links
The deprecated Carbon function FSIsAliasFile() returned isAlias only for actual aliases, whereas the replacement CFURLCopyResourcePropertyForKey with kCFURLIsAliasFileKey returns true for both aliases and symbolic links. Since we didn't explicitly check for AliasType in any of our internal code, or or any of the public API, the distinction did not cause any issues, but if we want to expose QFileInfo::isAlias() we need to fix this. Pick-to: 6.2 6.3 5.15 Change-Id: I29f795d55fe40898de319aa1cb0a4a1b5646bbd6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
55136998b3
commit
34b5e38f20
@ -891,6 +891,8 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
|
||||
if (!data.hasFlags(QFileSystemMetaData::DirectoryType))
|
||||
what |= QFileSystemMetaData::DirectoryType;
|
||||
}
|
||||
if (what & QFileSystemMetaData::AliasType)
|
||||
what |= QFileSystemMetaData::LinkType;
|
||||
#endif
|
||||
#ifdef UF_HIDDEN
|
||||
if (what & QFileSystemMetaData::HiddenAttribute) {
|
||||
@ -1026,8 +1028,11 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
if (what & QFileSystemMetaData::AliasType) {
|
||||
if (entryErrno == 0 && hasResourcePropertyFlag(data, entry, kCFURLIsAliasFileKey))
|
||||
data.entryFlags |= QFileSystemMetaData::AliasType;
|
||||
if (entryErrno == 0 && hasResourcePropertyFlag(data, entry, kCFURLIsAliasFileKey)) {
|
||||
// kCFURLIsAliasFileKey includes symbolic links, so filter those out
|
||||
if (!(data.entryFlags & QFileSystemMetaData::LinkType))
|
||||
data.entryFlags |= QFileSystemMetaData::AliasType;
|
||||
}
|
||||
data.knownFlagsMask |= QFileSystemMetaData::AliasType;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user