From a9f3cba3cecfe982739503cc3844289320183019 Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Thu, 7 Dec 2023 19:55:55 +0100 Subject: [PATCH] Update version string handling --- cpp/shared/s2p_util.cpp | 11 +++++++---- cpp/shared/s2p_version.h | 8 ++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cpp/shared/s2p_util.cpp b/cpp/shared/s2p_util.cpp index de0fbb26..a3cc23ac 100644 --- a/cpp/shared/s2p_util.cpp +++ b/cpp/shared/s2p_util.cpp @@ -21,8 +21,8 @@ using namespace filesystem; string s2p_util::GetVersionString() { - return fmt::format("{0}.{1}{2}", s2p_major_version, s2p_minor_version, - s2p_patch_version < 0 ? " --DEVELOPMENT BUILD--" : "." + to_string(s2p_patch_version)); + return fmt::format("{0}.{1}{2}{3}", s2p_major_version, s2p_minor_version, + s2p_patch_version <= 0 ? "" : "." + to_string(s2p_patch_version), s2p_version_prefix); } vector s2p_util::Split(const string& s, char separator, int limit) @@ -111,8 +111,11 @@ string s2p_util::Banner(string_view app) stringstream s; s << "SCSI Target Emulator and SCSI Initiator Tools SCSI2Pi " << app << "\n" - << "Version " << GetVersionString() << " (" << __DATE__ << ' ' << __TIME__ << ")\n" - << "Copyright (C) 2016-2020 GIMONS\n" + << "Version " << GetVersionString(); + if (!s2p_version_prefix.empty()) { + s << " (" << __DATE__ << ' ' << __TIME__ << ")"; + } + s << "\nCopyright (C) 2016-2020 GIMONS\n" << "Copyright (C) 2020-2023 Contributors to the PiSCSI project\n" << "Copyright (C) 2023 Uwe Seimet\n"; diff --git a/cpp/shared/s2p_version.h b/cpp/shared/s2p_version.h index dd0b044a..9e697b02 100644 --- a/cpp/shared/s2p_version.h +++ b/cpp/shared/s2p_version.h @@ -8,9 +8,13 @@ #pragma once +#include + inline const int s2p_major_version = 0; inline const int s2p_minor_version = 9; -// Patch count, -1 for development version -inline const int s2p_patch_version = -1; +inline const int s2p_patch_version = 0; + +// Version suffix, usually indicating a development version +inline const std::string s2p_version_prefix = "devel";