forked from qt-creator/qt-creator
fix "Open Command Prompt Here" on windows with qt 5.8
qt 5.8 made QProcess::startDetached()'s behavior consistent with start(), which means it won't open a console any more. however, qtc relied on this (unspecified) behavior. the correct solution is to add a static function startTerminalEmulator() to ConsoleProcess, which already has most of the necessary code anyway. Task-number: QTCREATORBUG-17439 Change-Id: Icf04666869ce6593555302a54c49331a29846a99 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
committed by
Robert Loehning
parent
4b0016fb2a
commit
ec50c146b3
@@ -31,15 +31,14 @@
|
||||
#include <coreplugin/iversioncontrol.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
#include <utils/consoleprocess.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/unixutils.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
||||
@@ -110,27 +109,11 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
|
||||
|
||||
void FileUtils::openTerminal(const QString &path)
|
||||
{
|
||||
// Get terminal application
|
||||
QString terminalEmulator;
|
||||
QStringList args;
|
||||
const OsType hostOs = HostOsInfo::hostOs();
|
||||
if (hostOs == OsTypeWindows) {
|
||||
terminalEmulator = ConsoleProcess::defaultTerminalEmulator();
|
||||
} else if (hostOs == OsTypeMac) {
|
||||
terminalEmulator = ICore::resourcePath()
|
||||
+ QLatin1String("/scripts/openTerminal.command");
|
||||
} else {
|
||||
args = QtcProcess::splitArgs(ConsoleProcess::terminalEmulator(ICore::settings()), hostOs);
|
||||
terminalEmulator = args.takeFirst();
|
||||
args.append(QString::fromLocal8Bit(qgetenv("SHELL")));
|
||||
}
|
||||
|
||||
// Launch terminal with working directory set.
|
||||
const QFileInfo fileInfo(path);
|
||||
const QString pwd = QDir::toNativeSeparators(fileInfo.isDir() ?
|
||||
fileInfo.absoluteFilePath() :
|
||||
fileInfo.absolutePath());
|
||||
QProcess::startDetached(terminalEmulator, args, pwd);
|
||||
ConsoleProcess::startTerminalEmulator(ICore::settings(), pwd);
|
||||
}
|
||||
|
||||
QString FileUtils::msgFindInDirectory()
|
||||
|
||||
Reference in New Issue
Block a user