diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index 841fc5002..66664cd86 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -25,7 +25,7 @@ #include "QRDUtils.h" #include #include -#include +#include #include #include #include @@ -1425,6 +1425,19 @@ bool RunProcessAsAdmin(const QString &fullExecutablePath, const QStringList &par #endif } +void RevealFilenameInExternalFileBrowser(const QString &filePath) +{ +#if defined(Q_OS_WIN32) + // on windows we can ask explorer to highlight the exact file. + QProcess::startDetached(lit("explorer.exe"), QStringList() << lit("/select,") + << QDir::toNativeSeparators(filePath)); +#else + // on all other platforms, we just use QDesktopServices to invoke the external file browser on the + // directory and hope that's close enough. + QDesktopServices::openUrl(QFileInfo(filePath).absoluteDir().absolutePath()); +#endif +} + QStringList ParseArgsList(const QString &args) { QStringList ret; diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index 9e6384901..0ee16a105 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -526,6 +526,8 @@ bool IsRunningAsAdmin(); bool RunProcessAsAdmin(const QString &fullExecutablePath, const QStringList ¶ms, std::function finishedCallback = std::function()); +void RevealFilenameInExternalFileBrowser(const QString &filePath); + void ShowProgressDialog(QWidget *window, const QString &labelText, ProgressFinishedMethod finished, ProgressUpdateMethod update = ProgressUpdateMethod());