Address review comments

This commit is contained in:
VolcaEM
2020-07-11 15:49:45 +02:00
committed by GitHub
parent a58b671f88
commit 97938c8681

View File

@@ -1894,16 +1894,15 @@ void GMainWindow::OnOpenFAQ() {
} }
void GMainWindow::OpenFolderSpecifyingFile(const QString& file) { void GMainWindow::OpenFolderSpecifyingFile(const QString& file) {
// Windows supports opening a folder with selecting a specified file in explorer. On every other // Windows supports opening a folder with selecting a specified file in explorer. On every other
// OS we just open the folder without preselecting the file. // OS we just open the folder without preselecting the file.
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
const QString explorer = QStringLiteral("explorer"); const QString explorer = QStringLiteral("explorer");
QStringList param; QStringList param;
if (!QFileInfo(file).isDir()) { if (!QFileInfo(file).isDir()) {
param << QStringLiteral("/select,"); param.push_back(QStringLiteral("/select,"));
} }
param << QDir::toNativeSeparators(file); param.push_back(QDir::toNativeSeparators(file));
QProcess::startDetached(explorer, param); QProcess::startDetached(explorer, param);
#else #else
QDesktopServices::openUrl(QUrl::fromLocalFile(file)); QDesktopServices::openUrl(QUrl::fromLocalFile(file));