Skip to content

Commit

Permalink
Update version string handling
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Dec 7, 2023
1 parent af042f6 commit a9f3cba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 7 additions & 4 deletions cpp/shared/s2p_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> s2p_util::Split(const string& s, char separator, int limit)
Expand Down Expand Up @@ -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";

Expand Down
8 changes: 6 additions & 2 deletions cpp/shared/s2p_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@

#pragma once

#include <string>

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";

0 comments on commit a9f3cba

Please sign in to comment.