| 261 | } |
| 262 | |
| 263 | void ShowInFileExplorer(QWidget* parent, const QFileInfo& file) |
| 264 | { |
| 265 | #if defined(_WIN32) |
| 266 | std::wstring wstr = QDir::toNativeSeparators(file.absoluteFilePath()).toStdWString(); |
| 267 | bool ok = false; |
| 268 | if (PIDLIST_ABSOLUTE pidl = ILCreateFromPath(wstr.c_str())) |
| 269 | { |
| 270 | ok = SUCCEEDED(SHOpenFolderAndSelectItems(pidl, 0, nullptr, 0)); |
| 271 | ILFree(pidl); |
| 272 | } |
| 273 | #elif defined(__APPLE__) |
| 274 | bool ok = CocoaTools::ShowInFinder(file.absoluteFilePath().toStdString()); |
| 275 | #else |
| 276 | bool ok = QDesktopServices::openUrl(QUrl::fromLocalFile(file.absolutePath())); |
| 277 | #endif |
| 278 | if (!ok) |
| 279 | { |
| 280 | QMessageBox::critical(parent, QCoreApplication::translate("FileOperations", "Failed to show file"), |
| 281 | QCoreApplication::translate("FileOperations", "Failed to show file in file explorer.\n\nThe file was: %1").arg(file.absoluteFilePath())); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | QString GetShowInFileExplorerMessage() |
| 286 | { |
no test coverage detected