From b6e3c6d718a17ca4491b9e503fca936185b85adb Mon Sep 17 00:00:00 2001 From: Felix Weilbach Date: Fri, 3 Sep 2021 21:47:40 +0200 Subject: [PATCH] Replace deprecated use of QProcess::start() Signed-off-by: Felix Weilbach --- src/gui/openfilemanager.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/gui/openfilemanager.cpp b/src/gui/openfilemanager.cpp index 3754bbd9f..4b8cc9361 100644 --- a/src/gui/openfilemanager.cpp +++ b/src/gui/openfilemanager.cpp @@ -103,27 +103,27 @@ void showInFileManager(const QString &localPath) return; #endif - QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH - QFileInfo fi(localPath); - - // canonicalFilePath returns empty if the file does not exist - if (!fi.canonicalFilePath().isEmpty()) { - QString nativeArgs; - if (!fi.isDir()) { - nativeArgs += QLatin1String("/select,"); - } - nativeArgs += QLatin1Char('"'); - nativeArgs += QDir::toNativeSeparators(fi.canonicalFilePath()); - nativeArgs += QLatin1Char('"'); - - QProcess p; + const QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH + QFileInfo fi(localPath); + + // canonicalFilePath returns empty if the file does not exist + if (!fi.canonicalFilePath().isEmpty()) { + QString nativeArgs; + if (!fi.isDir()) { + nativeArgs += QLatin1String("/select,"); + } + nativeArgs += QLatin1Char('"'); + nativeArgs += QDir::toNativeSeparators(fi.canonicalFilePath()); + nativeArgs += QLatin1Char('"'); + + QProcess p; #ifdef Q_OS_WIN // QProcess on Windows tries to wrap the whole argument/program string // with quotes if it detects a space in it, but explorer wants the quotes // only around the path. Use setNativeArguments to bypass this logic. p.setNativeArguments(nativeArgs); #endif - p.start(explorer); + p.start(explorer, QStringList {}); p.waitForFinished(5000); } } else if (Utility::isMac()) { -- 2.30.2