MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ShowInFileExplorer

Function ShowInFileExplorer

pcsx2-qt/QtUtils.cpp:263–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Calls 2

argMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected