ClearCaseSettings: Use FilePath for ccBinaryPath

Change-Id: I0de348d0b99a1f81d75418a7927c989283c4137a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-08-02 17:39:00 +02:00
parent 278d297397
commit b84c22b2fd
5 changed files with 12 additions and 15 deletions

View File

@@ -1658,9 +1658,8 @@ ClearCasePluginPrivate::runCleartool(const FilePath &workingDir,
unsigned flags, unsigned flags,
QTextCodec *outputCodec) const QTextCodec *outputCodec) const
{ {
const QString executable = m_settings.ccBinaryPath;
ClearCaseResponse response; ClearCaseResponse response;
if (executable.isEmpty()) { if (m_settings.ccBinaryPath.isEmpty()) {
response.error = true; response.error = true;
response.message = tr("No ClearCase executable specified."); response.message = tr("No ClearCase executable specified.");
return response; return response;
@@ -1669,7 +1668,7 @@ ClearCasePluginPrivate::runCleartool(const FilePath &workingDir,
auto *command = VcsBaseClient::createVcsCommand(workingDir, Environment::systemEnvironment()); auto *command = VcsBaseClient::createVcsCommand(workingDir, Environment::systemEnvironment());
command->addFlags(flags); command->addFlags(flags);
command->setCodec(outputCodec); command->setCodec(outputCodec);
const CommandResult result = command->runCommand({FilePath::fromString(executable), arguments}, const CommandResult result = command->runCommand({m_settings.ccBinaryPath, arguments},
timeOutS); timeOutS);
delete command; delete command;
@@ -2330,7 +2329,7 @@ void ClearCasePluginPrivate::diffGraphical(const QString &file1, const QString &
args << file1; args << file1;
if (!pred) if (!pred)
args << file2; args << file2;
QtcProcess::startDetached({FilePath::fromString(m_settings.ccBinaryPath), args}, m_topLevel); QtcProcess::startDetached({m_settings.ccBinaryPath, args}, m_topLevel);
} }
QString ClearCasePluginPrivate::runExtDiff(const FilePath &workingDir, const QStringList &arguments, QString ClearCasePluginPrivate::runExtDiff(const FilePath &workingDir, const QStringList &arguments,
@@ -2399,11 +2398,8 @@ bool ClearCasePluginPrivate::isConfigured() const
if (m_fakeClearTool) if (m_fakeClearTool)
return true; return true;
#endif #endif
const QString binary = m_settings.ccBinaryPath; const FilePath &binary = m_settings.ccBinaryPath;
if (binary.isEmpty()) return !binary.isEmpty() && binary.exists() && binary.isFile() && binary.isExecutableFile();
return false;
QFileInfo fi(binary);
return fi.exists() && fi.isFile() && fi.isExecutable();
} }
bool ClearCasePluginPrivate::supportsOperation(Operation operation) const bool ClearCasePluginPrivate::supportsOperation(Operation operation) const

View File

@@ -69,7 +69,7 @@ void ClearCaseSettings::fromSettings(QSettings *settings)
{ {
settings->beginGroup(QLatin1String(groupC)); settings->beginGroup(QLatin1String(groupC));
ccCommand = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString(); ccCommand = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString();
ccBinaryPath = Utils::Environment::systemEnvironment().searchInPath(ccCommand).toString(); ccBinaryPath = Utils::Environment::systemEnvironment().searchInPath(ccCommand);
timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt(); timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
autoCheckOut = settings->value(QLatin1String(autoCheckOutKeyC), false).toBool(); autoCheckOut = settings->value(QLatin1String(autoCheckOutKeyC), false).toBool();
noComment = settings->value(QLatin1String(noCommentKeyC), false).toBool(); noComment = settings->value(QLatin1String(noCommentKeyC), false).toBool();

View File

@@ -26,6 +26,8 @@
#pragma once #pragma once
#include <utils/filepath.h>
#include <QHash> #include <QHash>
#include <QString> #include <QString>
@@ -60,7 +62,7 @@ public:
{ return !p1.equals(p2); } { return !p1.equals(p2); }
QString ccCommand; QString ccCommand;
QString ccBinaryPath; Utils::FilePath ccBinaryPath;
DiffType diffType = GraphicalDiff; DiffType diffType = GraphicalDiff;
QString diffArgs; QString diffArgs;
QString indexOnlyVOBs; QString indexOnlyVOBs;

View File

@@ -52,7 +52,7 @@ static void runProcess(QFutureInterface<void> &future,
const QString viewRoot = ClearCasePlugin::viewData().root; const QString viewRoot = ClearCasePlugin::viewData().root;
QtcProcess process; QtcProcess process;
process.setWorkingDirectory(FilePath::fromString(viewRoot)); process.setWorkingDirectory(FilePath::fromString(viewRoot));
process.setCommand({FilePath::fromString(settings.ccBinaryPath), args}); process.setCommand({settings.ccBinaryPath, args});
process.start(); process.start();
if (!process.waitForStarted()) if (!process.waitForStarted())
return; return;
@@ -233,8 +233,7 @@ void ClearCaseSync::run(QFutureInterface<void> &future, QStringList &files)
if (settings.disableIndexer) if (settings.disableIndexer)
return; return;
const QString program = settings.ccBinaryPath; if (settings.ccBinaryPath.isEmpty())
if (program.isEmpty())
return; return;
// refresh activities list // refresh activities list

View File

@@ -101,7 +101,7 @@ void SettingsPageWidget::apply()
{ {
ClearCaseSettings rc; ClearCaseSettings rc;
rc.ccCommand = m_ui.commandPathChooser->rawFilePath().toString(); rc.ccCommand = m_ui.commandPathChooser->rawFilePath().toString();
rc.ccBinaryPath = m_ui.commandPathChooser->filePath().toString(); rc.ccBinaryPath = m_ui.commandPathChooser->filePath();
rc.timeOutS = m_ui.timeOutSpinBox->value(); rc.timeOutS = m_ui.timeOutSpinBox->value();
rc.autoCheckOut = m_ui.autoCheckOutCheckBox->isChecked(); rc.autoCheckOut = m_ui.autoCheckOutCheckBox->isChecked();
rc.noComment = m_ui.noCommentCheckBox->isChecked(); rc.noComment = m_ui.noCommentCheckBox->isChecked();