mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Add a function to reveal a file in the platform's external file browser
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include "QRDUtils.h"
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <QApplication>
|
||||
#include <QElapsedTimer>
|
||||
#include <QDesktopServices>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFileSystemModel>
|
||||
#include <QFontDatabase>
|
||||
@@ -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;
|
||||
|
||||
@@ -526,6 +526,8 @@ bool IsRunningAsAdmin();
|
||||
bool RunProcessAsAdmin(const QString &fullExecutablePath, const QStringList ¶ms,
|
||||
std::function<void()> finishedCallback = std::function<void()>());
|
||||
|
||||
void RevealFilenameInExternalFileBrowser(const QString &filePath);
|
||||
|
||||
void ShowProgressDialog(QWidget *window, const QString &labelText, ProgressFinishedMethod finished,
|
||||
ProgressUpdateMethod update = ProgressUpdateMethod());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user