From 2499b8896604e8b0ec8b93b763ec6d3659655fa7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 18 Jan 2022 15:37:42 +0100 Subject: [PATCH] macOS: Use "open -R" for showing files in Finder Instead of using AppleScript. Available since at least macOS 10.13. Change-Id: I088efc211189aab75480b3ea02f90cc235724bef Reviewed-by: Christian Stenger --- src/plugins/coreplugin/fileutils.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/plugins/coreplugin/fileutils.cpp b/src/plugins/coreplugin/fileutils.cpp index 6e7e7407cfc..a17923deca6 100644 --- a/src/plugins/coreplugin/fileutils.cpp +++ b/src/plugins/coreplugin/fileutils.cpp @@ -93,18 +93,7 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const FilePath &pathIn) param += QDir::toNativeSeparators(fileInfo.canonicalFilePath()); QtcProcess::startDetached({explorer, param}); } else if (HostOsInfo::isMacHost()) { - QStringList scriptArgs; - scriptArgs << QLatin1String("-e") - << QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"") - .arg(fileInfo.canonicalFilePath()); - QtcProcess osascriptProcess; - osascriptProcess.setCommand({"/usr/bin/osascript", scriptArgs}); - osascriptProcess.runBlocking(); - scriptArgs.clear(); - scriptArgs << QLatin1String("-e") - << QLatin1String("tell application \"Finder\" to activate"); - osascriptProcess.setCommand({"/usr/bin/osascript", scriptArgs}); - osascriptProcess.runBlocking(); + QtcProcess::startDetached({"/usr/bin/open", {"-R", fileInfo.canonicalFilePath()}}); } else { // we cannot select a file here, because no file browser really supports it... const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.filePath();