diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2025-05-29 11:04:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-29 11:04:36 +0200 |
| commit | 39210af3e59c929cba6de2d39ef1c32835f6388b (patch) | |
| tree | b77879fa376e7bfa016b14aa7635e7202b6cc69e /src/shared/util.cpp | |
| parent | 3a8ea3cccee06397e90305e1e39a305f8b7c3cb3 (diff) | |
Move to VCPKG (#2068)
* Remove SConscript related files.
* Force-load translations from uibase and gamebryo/creation.
* Bring githubpp here and add a standalone preset.
* Switch VersionInfo -> Version for ModOrganizer2. (#2063)
* Add pre-commit hook.
* Use 7zip build from VCPKG registry.
* Use archive.dll from the bin folder instead of dlls.
Diffstat (limited to 'src/shared/util.cpp')
| -rw-r--r-- | src/shared/util.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/shared/util.cpp b/src/shared/util.cpp index f17c21b9..0d9788a2 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -21,7 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "../env.h" #include "../mainwindow.h" #include "windows_error.h" -#include <log.h> +#include <uibase/log.h> #include <usvfs/usvfs.h> #include <usvfs/usvfs_version.h> @@ -208,10 +208,12 @@ std::wstring GetFileVersionString(const std::wstring& fileName) } } -VersionInfo createVersionInfo() +Version createVersionInfo() { VS_FIXEDFILEINFO version = GetFileVersion(env::thisProcessPath().native()); + std::optional<Version::ReleaseType> releaseType; + if (version.dwFileFlags & VS_FF_PRERELEASE) { // Pre-release builds need annotating QString versionString = @@ -227,21 +229,29 @@ VersionInfo createVersionInfo() } } + if (!noLetters) { + // trust the string to make sense + return Version::parse(versionString, Version::ParseMode::MO2); + } + if (noLetters) { - // Default to pre-alpha when release type is unspecified - return VersionInfo( - version.dwFileVersionMS >> 16, version.dwFileVersionMS & 0xFFFF, - version.dwFileVersionLS >> 16, version.dwFileVersionLS & 0xFFFF, - VersionInfo::RELEASE_PREALPHA); + // default to development when release type is unspecified + releaseType = Version::Development; } else { - // Trust the string to make sense - return VersionInfo(versionString); } - } else { - // Non-pre-release builds just need their version numbers reading - return VersionInfo(version.dwFileVersionMS >> 16, version.dwFileVersionMS & 0xFFFF, - version.dwFileVersionLS >> 16, version.dwFileVersionLS & 0xFFFF); } + + const int major = version.dwFileVersionMS >> 16, + minor = version.dwFileVersionMS & 0xFFFF, + patch = version.dwFileVersionLS >> 16, + subpatch = version.dwFileVersionLS & 0xFFFF; + + std::vector<std::variant<int, Version::ReleaseType>> prereleases; + if (releaseType) { + prereleases.push_back(*releaseType); + } + + return Version(major, minor, patch, subpatch, std::move(prereleases)); } QString getUsvfsDLLVersion() |
