forked from qt-creator/qt-creator
Utils: Use QtcProcess
Change-Id: Ia3cd4706c6b23a17bc4d84d06018ad16a4e3f428 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -131,6 +131,7 @@ public:
|
|||||||
bool operator>(const FilePath &other) const;
|
bool operator>(const FilePath &other) const;
|
||||||
bool operator>=(const FilePath &other) const;
|
bool operator>=(const FilePath &other) const;
|
||||||
FilePath operator+(const QString &s) const;
|
FilePath operator+(const QString &s) const;
|
||||||
|
FilePath operator/(const QString &str) const;
|
||||||
|
|
||||||
bool isChildOf(const FilePath &s) const;
|
bool isChildOf(const FilePath &s) const;
|
||||||
bool isChildOf(const QDir &dir) const;
|
bool isChildOf(const QDir &dir) const;
|
||||||
@@ -163,8 +164,6 @@ public:
|
|||||||
FilePath resolveSymlinks() const;
|
FilePath resolveSymlinks() const;
|
||||||
FilePath withExecutableSuffix() const;
|
FilePath withExecutableSuffix() const;
|
||||||
|
|
||||||
FilePath operator/(const QString &str) const;
|
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include <utils/commandline.h>
|
#include <utils/commandline.h>
|
||||||
#include <utils/textfileformat.h>
|
#include <utils/textfileformat.h>
|
||||||
#include <utils/unixutils.h>
|
#include <utils/unixutils.h>
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -88,17 +89,20 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const FilePath &pathIn)
|
|||||||
if (!pathIn.isDir())
|
if (!pathIn.isDir())
|
||||||
param += QLatin1String("/select,");
|
param += QLatin1String("/select,");
|
||||||
param += QDir::toNativeSeparators(fileInfo.canonicalFilePath());
|
param += QDir::toNativeSeparators(fileInfo.canonicalFilePath());
|
||||||
QProcess::startDetached(explorer.toString(), param);
|
QtcProcess::startDetached({explorer, param});
|
||||||
} else if (HostOsInfo::isMacHost()) {
|
} else if (HostOsInfo::isMacHost()) {
|
||||||
QStringList scriptArgs;
|
QStringList scriptArgs;
|
||||||
scriptArgs << QLatin1String("-e")
|
scriptArgs << QLatin1String("-e")
|
||||||
<< QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"")
|
<< QString::fromLatin1("tell application \"Finder\" to reveal POSIX file \"%1\"")
|
||||||
.arg(fileInfo.canonicalFilePath());
|
.arg(fileInfo.canonicalFilePath());
|
||||||
QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs);
|
QtcProcess osascriptProcess;
|
||||||
|
osascriptProcess.setCommand({"/usr/bin/osascript", scriptArgs});
|
||||||
|
osascriptProcess.runBlocking();
|
||||||
scriptArgs.clear();
|
scriptArgs.clear();
|
||||||
scriptArgs << QLatin1String("-e")
|
scriptArgs << QLatin1String("-e")
|
||||||
<< QLatin1String("tell application \"Finder\" to activate");
|
<< QLatin1String("tell application \"Finder\" to activate");
|
||||||
QProcess::execute(QLatin1String("/usr/bin/osascript"), scriptArgs);
|
osascriptProcess.setCommand({"/usr/bin/osascript", scriptArgs});
|
||||||
|
osascriptProcess.runBlocking();
|
||||||
} else {
|
} else {
|
||||||
// we cannot select a file here, because no file browser really supports it...
|
// we cannot select a file here, because no file browser really supports it...
|
||||||
const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.filePath();
|
const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.filePath();
|
||||||
|
@@ -383,7 +383,7 @@ QDate UpdateInfoPlugin::nextCheckDate(CheckUpdateInterval interval) const
|
|||||||
|
|
||||||
void UpdateInfoPlugin::startUpdater()
|
void UpdateInfoPlugin::startUpdater()
|
||||||
{
|
{
|
||||||
QProcess::startDetached(d->m_maintenanceTool, QStringList(QLatin1String("--updater")));
|
Utils::QtcProcess::startDetached({Utils::FilePath::fromString(d->m_maintenanceTool), {"--updater"}});
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace Internal
|
} //namespace Internal
|
||||||
|
Reference in New Issue
Block a user