QCocoaFileDialogHelper: Always enable symlinks and aliases to directories

We always enable directories, so that the user can navigate into them,
so we should do the same for symlinks and aliases to directories.

This is the same behavior the native dialog has when not implementing
shouldEnableURL and relying purely on allowedFileTypes.

Fixes: QTBUG-28379
Change-Id: I7ae4eb8120aa87cb685f3561d5e1c7257b0c9349
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 87725ee75981ec9ab25456c41acc74681c85ae2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
William Jones 2022-02-15 18:26:21 -05:00 committed by Qt Cherry-pick Bot
parent 4d09496284
commit ff7592f375

View File

@ -292,7 +292,12 @@ static QString strippedText(QString s)
}
}
QString qtFileName = QFileInfo(QString::fromNSString(filename)).fileName();
// Treat symbolic links and aliases to directories like directories
QFileInfo fileInfo(QString::fromNSString(filename));
if (fileInfo.isSymLink() && QFileInfo(fileInfo.symLinkTarget()).isDir())
return YES;
QString qtFileName = fileInfo.fileName();
// No filter means accept everything
bool nameMatches = mSelectedNameFilter->isEmpty();
// Check if the current file name filter accepts the file: