forked from qt-creator/qt-creator
Meson: Use QVersionNumber instead of self-made substitute
Change-Id: I6d4168a0be3e14f39baf469f47bc292779fe286a Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -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 {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user