Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,7 @@ function Package-Artifacts {
Remove-Item $LinuxTar
}

if ($Config.BuildAndroid -eq "true") {
if (Test-Path "android\test.apk") {
Move-Item "android\test.apk" "valkyrie-android-$Version.apk" -Force
}
}

}

function Create-Installer {
Expand Down Expand Up @@ -396,7 +392,7 @@ if ($Config.BuildAndroid -eq "true") {
Invoke-CommandChecked { jarsigner -verify -verbose -certs $ApkPath } "Jarsigner verify failed"

Write-Log "Aligning APK..."
$AlignedApk = "$BuildDir\Valkyrie-android-$Version.apk"
$AlignedApk = "$BuildDir\Valkyrie-android-$OutputVersion.apk"
Invoke-CommandChecked { zipalign -v 4 $ApkPath $AlignedApk } "Zipalign failed"
Write-Log "Android post-processing complete."
}
Expand Down
39 changes: 20 additions & 19 deletions unity/Assets/Scripts/VersionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,32 +64,33 @@ public static bool VersionNewer(string oldVersion, string newVersion)

if (oldVersion.Equals("")) return true;

// Different number of components
if (oldV.Length != newV.Length)
{
return true;
}
int maxLen = Math.Max(oldV.Length, newV.Length);

// Check each component
for (int i = 0; i < oldV.Length; i++)
for (int i = 0; i < maxLen; i++)
{
// Strip for only numbers
string oldS = System.Text.RegularExpressions.Regex.Replace(oldV[i], "[^0-9]", "");
string newS = System.Text.RegularExpressions.Regex.Replace(newV[i], "[^0-9]", "");
try
int oldInt = 0;
int newInt = 0;

if (i < oldV.Length)
{
string oldS = System.Text.RegularExpressions.Regex.Replace(oldV[i], "[^0-9]", "");
int.TryParse(oldS, out oldInt);
}
if (i < newV.Length)
{
if (int.Parse(oldS) < int.Parse(newS))
{
return true;
}
if (int.Parse(oldS) > int.Parse(newS))
{
return false;
}
string newS = System.Text.RegularExpressions.Regex.Replace(newV[i], "[^0-9]", "");
int.TryParse(newS, out newInt);
}
catch (System.Exception)

if (oldInt < newInt)
{
return true;
}
if (oldInt > newInt)
{
return false;
}
}
return false;
}
Expand Down