fix: don't assume stable channel, if tag is unset
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
89a30a47c5
commit
cbc1aad58d
@ -64,12 +64,16 @@ Config::Config()
|
|||||||
GIT_COMMIT = "@Launcher_GIT_COMMIT@";
|
GIT_COMMIT = "@Launcher_GIT_COMMIT@";
|
||||||
GIT_TAG = "@Launcher_GIT_TAG@";
|
GIT_TAG = "@Launcher_GIT_TAG@";
|
||||||
GIT_REFSPEC = "@Launcher_GIT_REFSPEC@";
|
GIT_REFSPEC = "@Launcher_GIT_REFSPEC@";
|
||||||
|
|
||||||
|
// Assume that builds outside of Git repos are "stable"
|
||||||
if (GIT_REFSPEC == QStringLiteral("GITDIR-NOTFOUND")
|
if (GIT_REFSPEC == QStringLiteral("GITDIR-NOTFOUND")
|
||||||
|| GIT_TAG == QStringLiteral("-128-NOTFOUND"))
|
|| GIT_TAG == QStringLiteral("GITDIR-NOTFOUND"))
|
||||||
{
|
{
|
||||||
VERSION_CHANNEL = QStringLiteral("stable");
|
GIT_REFSPEC = "refs/heads/stable";
|
||||||
|
GIT_TAG = versionString();
|
||||||
}
|
}
|
||||||
else if(GIT_REFSPEC.startsWith("refs/heads/"))
|
|
||||||
|
if (GIT_REFSPEC.startsWith("refs/heads/"))
|
||||||
{
|
{
|
||||||
VERSION_CHANNEL = GIT_REFSPEC;
|
VERSION_CHANNEL = GIT_REFSPEC;
|
||||||
VERSION_CHANNEL.remove("refs/heads/");
|
VERSION_CHANNEL.remove("refs/heads/");
|
||||||
@ -83,7 +87,7 @@ Config::Config()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VERSION_CHANNEL = QObject::tr("unknown");
|
VERSION_CHANNEL = "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION_STR = "@Launcher_VERSION_STRING@";
|
VERSION_STR = "@Launcher_VERSION_STRING@";
|
||||||
@ -102,9 +106,14 @@ Config::Config()
|
|||||||
SUBREDDIT_URL = "@Launcher_SUBREDDIT_URL@";
|
SUBREDDIT_URL = "@Launcher_SUBREDDIT_URL@";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Config::versionString() const
|
||||||
|
{
|
||||||
|
return QString("%1.%2.%3").arg(VERSION_MAJOR).arg(VERSION_MINOR).arg(VERSION_HOTFIX);
|
||||||
|
}
|
||||||
|
|
||||||
QString Config::printableVersionString() const
|
QString Config::printableVersionString() const
|
||||||
{
|
{
|
||||||
QString vstr = QString("%1.%2.%3").arg(VERSION_MAJOR).arg(VERSION_MINOR).arg(VERSION_HOTFIX);
|
QString vstr = versionString();
|
||||||
|
|
||||||
// If the build is not a main release, append the channel
|
// If the build is not a main release, append the channel
|
||||||
if(VERSION_CHANNEL != "stable" && GIT_TAG != vstr)
|
if(VERSION_CHANNEL != "stable" && GIT_TAG != vstr)
|
||||||
|
@ -157,6 +157,7 @@ class Config {
|
|||||||
QString MODRINTH_STAGING_URL = "https://staging-api.modrinth.com/v2";
|
QString MODRINTH_STAGING_URL = "https://staging-api.modrinth.com/v2";
|
||||||
QString MODRINTH_PROD_URL = "https://api.modrinth.com/v2";
|
QString MODRINTH_PROD_URL = "https://api.modrinth.com/v2";
|
||||||
|
|
||||||
|
QString versionString() const;
|
||||||
/**
|
/**
|
||||||
* \brief Converts the Version to a string.
|
* \brief Converts the Version to a string.
|
||||||
* \return The version number in string format (major.minor.revision.build).
|
* \return The version number in string format (major.minor.revision.build).
|
||||||
|
Loading…
Reference in New Issue
Block a user