Autotest: Use more FilePath

Change-Id: I15de1121305f245274d74b4116786f6f07ffa3c2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-09-22 17:23:20 +02:00
parent 9e9c0630ee
commit 5dcfbe6c52
3 changed files with 7 additions and 5 deletions

View File

@@ -487,7 +487,7 @@ QVector<QObject *> AutotestPlugin::createTestObjects() const
bool ChoicePair::matches(const ProjectExplorer::RunConfiguration *rc) const bool ChoicePair::matches(const ProjectExplorer::RunConfiguration *rc) const
{ {
return rc && rc->displayName() == displayName && rc->runnable().command.executable().toString() == executable; return rc && rc->displayName() == displayName && rc->runnable().command.executable() == executable;
} }
} // Internal } // Internal

View File

@@ -7,6 +7,8 @@
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <utils/filepath.h>
namespace ProjectExplorer { namespace ProjectExplorer {
class Project; class Project;
class RunConfiguration; class RunConfiguration;
@@ -20,12 +22,12 @@ struct TestSettings;
struct ChoicePair struct ChoicePair
{ {
explicit ChoicePair(const QString &name = QString(), const QString &exe = QString()) explicit ChoicePair(const QString &name = {}, const Utils::FilePath &exe = {})
: displayName(name), executable(exe) {} : displayName(name), executable(exe) {}
bool matches(const ProjectExplorer::RunConfiguration *rc) const; bool matches(const ProjectExplorer::RunConfiguration *rc) const;
QString displayName; QString displayName;
QString executable; Utils::FilePath executable;
}; };
class AutotestPlugin : public ExtensionSystem::IPlugin class AutotestPlugin : public ExtensionSystem::IPlugin

View File

@@ -446,11 +446,11 @@ static RunConfiguration *getRunConfiguration(const QString &buildTargetKey)
if (dName.isEmpty()) if (dName.isEmpty())
return nullptr; return nullptr;
// run configuration has been selected - fill config based on this one.. // run configuration has been selected - fill config based on this one..
const QString exe = dialog.executable(); const FilePath exe = FilePath::fromString(dialog.executable());
runConfig = Utils::findOr(runConfigurations, nullptr, [&dName, &exe] (const RunConfiguration *rc) { runConfig = Utils::findOr(runConfigurations, nullptr, [&dName, &exe] (const RunConfiguration *rc) {
if (rc->displayName() != dName) if (rc->displayName() != dName)
return false; return false;
return rc->runnable().command.executable().toString() == exe; return rc->runnable().command.executable() == exe;
}); });
if (runConfig && dialog.rememberChoice()) if (runConfig && dialog.rememberChoice())
AutotestPlugin::cacheRunConfigChoice(buildTargetKey, ChoicePair(dName, exe)); AutotestPlugin::cacheRunConfigChoice(buildTargetKey, ChoicePair(dName, exe));