diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2018-05-15 17:55:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-15 17:55:02 -0500 |
| commit | 75e6c72ae4132ae4d71f5f04f666f5e33c17d1d3 (patch) | |
| tree | 7dabba3c8eee2849d566eee8fd52a995dac7e220 /src/selfupdater.cpp | |
| parent | 2ee5f0e96dd6928c271e1b37cd1f77ddc456ef9c (diff) | |
| parent | 9c1806cc74a1600f1c28610532d9a06434adf30d (diff) | |
Merge pull request #360 from AnyOldName3/better-version-parsing
Better version parsing
Diffstat (limited to 'src/selfupdater.cpp')
| -rw-r--r-- | src/selfupdater.cpp | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp index d671bafc..a57b7962 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -104,10 +104,45 @@ SelfUpdater::SelfUpdater(NexusInterface *nexusInterface) VS_FIXEDFILEINFO version = GetFileVersion(ToWString(QApplication::applicationFilePath()));
- m_MOVersion = VersionInfo(version.dwFileVersionMS >> 16,
- version.dwFileVersionMS & 0xFFFF,
- version.dwFileVersionLS >> 16,
- version.dwFileVersionLS & 0xFFFF);
+ if (version.dwFileFlags | VS_FF_PRERELEASE)
+ {
+ // Pre-release builds need annotating
+ QString versionString = QString::fromStdWString(GetFileVersionString(ToWString(QApplication::applicationFilePath())));
+
+ // The pre-release flag can be set without the string specifying what type of pre-release
+ bool noLetters = true;
+ for (QChar character : versionString)
+ {
+ if (character.isLetter())
+ {
+ noLetters = false;
+ break;
+ }
+ }
+
+ if (noLetters)
+ {
+ // Default to pre-alpha when release type is unspecified
+ m_MOVersion = VersionInfo(version.dwFileVersionMS >> 16,
+ version.dwFileVersionMS & 0xFFFF,
+ version.dwFileVersionLS >> 16,
+ version.dwFileVersionLS & 0xFFFF,
+ VersionInfo::RELEASE_PREALPHA);
+ }
+ else
+ {
+ // Trust the string to make sense
+ m_MOVersion = VersionInfo(versionString);
+ }
+ }
+ else
+ {
+ // Non-pre-release builds just need their version numbers reading
+ m_MOVersion = VersionInfo(version.dwFileVersionMS >> 16,
+ version.dwFileVersionMS & 0xFFFF,
+ version.dwFileVersionLS >> 16,
+ version.dwFileVersionLS & 0xFFFF);
+ }
}
|
