Meson: Use QVersionNumber instead of self-made substitute

Change-Id: I6d4168a0be3e14f39baf469f47bc292779fe286a
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-07-25 07:05:42 +02:00
parent 319e87fd6c
commit f9bb9feda4
11 changed files with 28 additions and 86 deletions

View File

@@ -44,7 +44,7 @@ ToolWrapper::ToolWrapper(ToolType toolType,
bool autoDetected)
: m_toolType(toolType)
, m_version(read_version(path))
, m_isValid{path.exists() && m_version.isValid}
, m_isValid{path.exists() && !m_version.isNull()}
, m_autoDetected{autoDetected}
, m_id{Id::generate()}
, m_exe{path}
@@ -58,7 +58,7 @@ ToolWrapper::ToolWrapper(ToolType toolType,
bool autoDetected)
: m_toolType(toolType)
, m_version(read_version(path))
, m_isValid{path.exists() && m_version.isValid}
, m_isValid{path.exists() && !m_version.isNull()}
, m_autoDetected{autoDetected}
, m_id{id}
, m_exe{path}
@@ -75,14 +75,14 @@ void ToolWrapper::setExe(const FilePath &newExe)
m_version = read_version(m_exe);
}
Version ToolWrapper::read_version(const FilePath &toolPath)
QVersionNumber ToolWrapper::read_version(const FilePath &toolPath)
{
if (toolPath.toFileInfo().isExecutable()) {
Process process;
process.setCommand({ toolPath, { "--version" } });
process.start();
if (process.waitForFinished())
return Version::fromString(process.cleanedStdOut());
return QVersionNumber::fromString(process.cleanedStdOut());
}
return {};
}