Use QProcess::startCommand with Qt 6

This commit is contained in:
Jonas Kvinge 2021-06-20 02:48:58 +02:00
parent 310995fb87
commit 755abec636
1 changed files with 6 additions and 2 deletions

View File

@ -342,13 +342,17 @@ QString ColorToRgba(const QColor &c) {
}
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
void OpenInFileManager(const QString path, const QUrl &url);
void OpenInFileManager(const QString path, const QUrl &url) {
void OpenInFileManager(const QString &path, const QUrl &url);
void OpenInFileManager(const QString &path, const QUrl &url) {
if (!url.isLocalFile()) return;
QProcess proc;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
proc.startCommand("xdg-mime query default inode/directory");
#else
proc.start("xdg-mime", QStringList() << "query" << "default" << "inode/directory");
#endif
proc.waitForFinished();
QString desktop_file = proc.readLine().simplified();
QStringList data_dirs = QString(getenv("XDG_DATA_DIRS")).split(":");