Skip to content

Commit

Permalink
Fix false "up-to-date" when release suffix changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparronator9999 committed Jan 24, 2025
1 parent 799d6e2 commit b216841
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions YAMDCC.Updater/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,33 @@ public static bool IsUpdateAvailable(Release release)
Version current = Utils.GetCurrentVersion(),
latest = Utils.GetVersion(tag);

// check if version suffixes are different
// if they are, we probably need to update
if (latestSuffix != currentSuffix)
{
return true;
}

if (current == latest)
{
// check if current version is a beta/RC/hotfix
// but latest is a full release with same base version
if (currentSuffix != "release" && latestSuffix == string.Empty)
{
return true;
}
else
// check if pre-release version is out of date
int latestSuffixVer = Utils.GetSuffixVer(tag),
currentSuffixVer = Utils.GetCurrentSuffixVer(),
i = 0;

while (currentSuffixVer != -1 || latestSuffixVer != -1)
{
// check if pre-release version is out of date
int latestSuffixVer = Utils.GetSuffixVer(tag),
currentSuffixVer = Utils.GetCurrentSuffixVer(),
i = 0;
while (currentSuffixVer != -1 || latestSuffixVer != -1)
// this works even if current version
// doesn't have extra suffixes :)
if (currentSuffixVer < latestSuffixVer)
{
// this works even if current version
// doesn't have extra suffixes :)
if (currentSuffixVer < latestSuffixVer)
{
return true;
}
i++;
latestSuffixVer = Utils.GetSuffixVer(tag, i);
currentSuffixVer = Utils.GetCurrentSuffixVer(i);
return true;
}

return false;
i++;
latestSuffixVer = Utils.GetSuffixVer(tag, i);
currentSuffixVer = Utils.GetCurrentSuffixVer(i);
}
return false;
}
return true;
}
Expand Down

0 comments on commit b216841

Please sign in to comment.