Fix tagged version download
This commit is contained in:
@@ -13,7 +13,6 @@ execute_process(
|
||||
|
||||
if (GIT_DESC)
|
||||
string(STRIP ${GIT_DESC} GIT_DESC)
|
||||
string(REGEX REPLACE "^v([0-9])" "\\1" GIT_DESC ${GIT_DESC})
|
||||
message(STATUS "Setting version to ${GIT_DESC} from git")
|
||||
else()
|
||||
set(GIT_DESC v${CMAKE_PROJECT_VERSION})
|
||||
|
||||
@@ -7,7 +7,6 @@ else()
|
||||
endif()
|
||||
|
||||
if (GIT_DESC)
|
||||
string(REGEX REPLACE "^v([0-9])" "\\1" GIT_DESC ${GIT_DESC})
|
||||
configure_file(version.cpp.in version.cpp)
|
||||
else ()
|
||||
add_custom_target(wivrn-version ALL
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <cctype>
|
||||
#include <iterator>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
extern const char git_version[];
|
||||
@@ -24,4 +27,12 @@ namespace wivrn
|
||||
|
||||
extern const char git_commit[];
|
||||
const char git_commit[] = "@GIT_COMMIT@";
|
||||
|
||||
const char* display_version()
|
||||
{
|
||||
if (std::size(git_version) > 2 and git_version[0] == 'v' and isdigit(git_version[1]))
|
||||
return git_version + 1;
|
||||
else
|
||||
return git_version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,6 @@ namespace wivrn
|
||||
{
|
||||
extern const char git_version[];
|
||||
extern const char git_commit[];
|
||||
|
||||
const char * display_version();
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -42,9 +42,7 @@ bool apk_installer::isTagged() const
|
||||
|
||||
QString apk_installer::currentVersion() const
|
||||
{
|
||||
if (wivrn::git_version[0] == 'v')
|
||||
return &wivrn::git_version[1];
|
||||
return wivrn::git_version;
|
||||
return wivrn::display_version();
|
||||
}
|
||||
|
||||
QCoro::Task<> apk_installer::doRefreshLatestVersion()
|
||||
|
||||
+3
-3
@@ -354,7 +354,7 @@ void start_publishing()
|
||||
sprintf(protocol_string, "%016" PRIx64, wivrn::protocol_version);
|
||||
std::map<std::string, std::string> TXT = {
|
||||
{"protocol", protocol_string},
|
||||
{"version", wivrn::git_version},
|
||||
{"version", wivrn::display_version()},
|
||||
{"cookie", server_cookie()},
|
||||
};
|
||||
publisher.emplace(poll_api, hostname(), "_wivrn._tcp", wivrn::default_port, TXT);
|
||||
@@ -889,7 +889,7 @@ auto create_dbus_connection()
|
||||
|
||||
int inner_main(int argc, char * argv[], bool show_instructions)
|
||||
{
|
||||
std::cerr << "WiVRn " << wivrn::git_version << " starting" << std::endl;
|
||||
std::cerr << "WiVRn " << wivrn::display_version() << " starting" << std::endl;
|
||||
if (show_instructions)
|
||||
{
|
||||
if (auto command = steam_command(); not command.empty())
|
||||
@@ -998,7 +998,7 @@ int main(int argc, char * argv[])
|
||||
|
||||
if (*version_flag)
|
||||
{
|
||||
std::cout << "WiVRn version " << wivrn::git_version << std::endl;
|
||||
std::cout << "WiVRn version " << wivrn::display_version() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user