forked from qt-creator/qt-creator
QbsProjectManager: Do not try to call qbs if there is no executable
Otherwise, we'll get warnings from QProcess. Change-Id: Ibaa536729fa644583c8ddc7a2931ac0ee11c0c9e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
@@ -247,7 +247,10 @@ QString QbsProfileManager::runQbsConfig(QbsConfigOp op, const QString &key, cons
|
||||
args << "--unset" << key;
|
||||
break;
|
||||
}
|
||||
qbsConfig.start(QbsSettings::qbsExecutableFilePath().toString(), args);
|
||||
const Utils::FilePath qbsExe = QbsSettings::qbsExecutableFilePath();
|
||||
if (qbsExe.isEmpty() || !qbsExe.exists())
|
||||
return {};
|
||||
qbsConfig.start(qbsExe.toString(), args);
|
||||
if (!qbsConfig.waitForStarted(3000) || !qbsConfig.waitForFinished(5000)) {
|
||||
Core::MessageManager::write(tr("Failed run qbs config: %1").arg(qbsConfig.errorString()));
|
||||
} else if (qbsConfig.exitCode() != 0) {
|
||||
|
||||
@@ -219,7 +219,12 @@ void QbsSession::initialize()
|
||||
});
|
||||
connect(d->packetReader, &PacketReader::packetReceived, this, &QbsSession::handlePacket);
|
||||
d->state = State::Initializing;
|
||||
d->qbsProcess->start(QbsSettings::qbsExecutableFilePath().toString(), {"session"});
|
||||
const FilePath qbsExe = QbsSettings::qbsExecutableFilePath();
|
||||
if (qbsExe.isEmpty() || !qbsExe.exists()) {
|
||||
QTimer::singleShot(0, this, [this] { setError(Error::QbsFailedToStart); });
|
||||
return;
|
||||
}
|
||||
d->qbsProcess->start(qbsExe.toString(), {"session"});
|
||||
}
|
||||
|
||||
void QbsSession::sendQuitPacket()
|
||||
|
||||
@@ -159,8 +159,11 @@ public:
|
||||
private:
|
||||
static QString getQbsVersion()
|
||||
{
|
||||
const FilePath qbsExe = QbsSettings::qbsExecutableFilePath();
|
||||
if (qbsExe.isEmpty() || !qbsExe.exists())
|
||||
return tr("Failed to retrieve version.");
|
||||
QProcess qbsProc;
|
||||
qbsProc.start(QbsSettings::qbsExecutableFilePath().toString(), {"--version"});
|
||||
qbsProc.start(qbsExe.toString(), {"--version"});
|
||||
if (!qbsProc.waitForStarted(3000) || !qbsProc.waitForFinished(5000)
|
||||
|| qbsProc.exitCode() != 0) {
|
||||
return tr("Failed to retrieve version.");
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
static QbsSettings &instance();
|
||||
|
||||
static Utils::FilePath qbsExecutableFilePath();
|
||||
static bool hasQbsExecutable();
|
||||
static QString defaultInstallDirTemplate();
|
||||
static bool useCreatorSettingsDirForQbs();
|
||||
static QString qbsSettingsBaseDir();
|
||||
|
||||
Reference in New Issue
Block a user