Replace deprecated use of QProcess::start()
authorFelix Weilbach <felix.weilbach@nextcloud.com>
Fri, 3 Sep 2021 19:47:40 +0000 (21:47 +0200)
committerFelix Weilbach (Rebase PR Action) <felix.weilbach@t-online.de>
Wed, 8 Sep 2021 08:54:00 +0000 (08:54 +0000)
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
src/gui/openfilemanager.cpp

index 3754bbd9feab98eb0463b2382fa0a9f68ab3318d..4b8cc9361721673c86faf05b879886aef27b6289 100644 (file)
@@ -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()) {