mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T419, artifact name to platform
This commit is contained in:
committed by
Mat Sutcliffe
parent
b70b280d73
commit
d1b4660b20
@@ -201,6 +201,24 @@ namespace BlackMisc
|
||||
return unknown;
|
||||
}
|
||||
|
||||
CPlatform CArtifact::artifactNameToPlatform(const QString &name)
|
||||
{
|
||||
if (name.isEmpty()) { return CPlatform::unknownOs(); }
|
||||
const QString n(name.toLower().trimmed());
|
||||
if (n.contains("-windows-") || n.endsWith(".exe"))
|
||||
{
|
||||
if (n.contains("-64-")) { return CPlatform::win64Platform(); }
|
||||
if (n.contains("-32-")) { return CPlatform::win32Platform(); }
|
||||
return CPlatform::unknownOs();
|
||||
}
|
||||
|
||||
if (n.contains("-macos-") || n.endsWith(".dmg")) { return CPlatform::macOSPlatform(); }
|
||||
if (n.contains("-linux-") || n.endsWith(".run")) { return CPlatform::linuxPlatform(); }
|
||||
if (n.contains("-allos-")) { return CPlatform::allOs(); }
|
||||
|
||||
return CPlatform::unknownOs();
|
||||
}
|
||||
|
||||
QString CArtifact::versionNumberFromFilename(const QString &filename)
|
||||
{
|
||||
if (filename.isEmpty()) { return {}; }
|
||||
|
||||
@@ -143,6 +143,9 @@ namespace BlackMisc
|
||||
//! Type as string
|
||||
static const QString &typeToString(ArtifactType type);
|
||||
|
||||
//! Name to platform
|
||||
static CPlatform artifactNameToPlatform(const QString &name);
|
||||
|
||||
private:
|
||||
QString m_name; //!< channel the files belong to
|
||||
QString m_md5; //!< MD5 checksum
|
||||
|
||||
Reference in New Issue
Block a user