From 90c0d0d0aa486616bb61ee0c61094678619b561f Mon Sep 17 00:00:00 2001 From: daleclack Date: Wed, 3 Jul 2024 09:29:06 +0800 Subject: [PATCH] Fix major version string with 2 and more characters --- XeRelease_Gtkmm4/src/xerelease.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/XeRelease_Gtkmm4/src/xerelease.cc b/XeRelease_Gtkmm4/src/xerelease.cc index 81640ee..b60540d 100644 --- a/XeRelease_Gtkmm4/src/xerelease.cc +++ b/XeRelease_Gtkmm4/src/xerelease.cc @@ -84,19 +84,22 @@ static void path_translate(char *result, const char *version) { // Just combine the release file path and filename std::string path; + std::string tmp_str = std::string(version); + size_t pos = tmp_str.find_first_of("."); + std::string version_major = tmp_str.substr(0, pos); switch (get_os_type()) { case OS_Type::Linux: path = data1["Release_Path_Unix"]; - snprintf(result, 57, "%s/xe-%c.x", path.c_str(), version[0]); + snprintf(result, 57, "%s/xe-%s.x", path.c_str(), version_major.c_str()); break; case OS_Type::Darwin: path = data1["Release_Path_Darwin"]; - snprintf(result, 57, "%s/xe-%c.x", path.c_str(), version[0]); + snprintf(result, 57, "%s/xe-%s.x", path.c_str(), version_major.c_str()); break; case OS_Type::Windows: path = data1["Release_Path_Win32"]; - snprintf(result, 57, "%s\\xe-%c.x", path.c_str(), version[0]); + snprintf(result, 57, "%s\\xe-%s.x", path.c_str(), version_major.c_str()); break; } // if (rel_unix_file_system_detected())