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

View File

@@ -69,7 +69,7 @@ void ClearCaseSettings::fromSettings(QSettings *settings)
{
settings->beginGroup(QLatin1String(groupC));
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();
autoCheckOut = settings->value(QLatin1String(autoCheckOutKeyC), false).toBool();
noComment = settings->value(QLatin1String(noCommentKeyC), false).toBool();

View File

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

View File

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

View File

@@ -101,7 +101,7 @@ void SettingsPageWidget::apply()
{
ClearCaseSettings rc;
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.autoCheckOut = m_ui.autoCheckOutCheckBox->isChecked();
rc.noComment = m_ui.noCommentCheckBox->isChecked();