解决HGVersion在kylin系统上获取版本号不正确的问题

This commit is contained in:
luoliangyi 2022-07-28 09:13:25 +08:00
parent c96484dfae
commit b3eaba6fc4
1 changed files with 79 additions and 79 deletions

View File

@ -345,6 +345,81 @@ static void GetMacAddrList(std::vector<std::string>& macList)
#endif
}
static std::string GetOSName()
{
std::string osName;
#if defined(HG_CMP_MSC)
osName = "Windows";
#else
osName = "Linux";
FILE* fp = popen("cat /etc/issue | cut -d\' \' -f1", "r");
if (NULL != fp)
{
char buff[1024] = { 0 };
fread(buff, 1024, 1, fp);
int len = (int)strlen(buff);
for (int i = 0; i < len; ++i)
{
if (buff[i] == '\n')
buff[i] = '\0';
}
osName = buff;
pclose(fp);
}
#endif
return osName;
}
static std::string GetArchName()
{
std::string archName;
#if defined(HG_CMP_MSC)
#ifdef _WIN64
archName = "x64";
#else
archName = "x86";
#endif
#else
archName = "unknown";
FILE *fp = popen("arch", "r");
if (NULL != fp)
{
char buff[1024] = { 0 };
fread(buff, 1024, 1, fp);
int len = (int)strlen(buff);
for (int i = 0; i < len; ++i)
{
if (buff[i] == '\n')
buff[i] = '\0';
}
archName = buff;
pclose(fp);
}
#endif
return archName;
}
static std::string GetOemName()
{
std::string oemName;
#if defined(OEM_HANWANG)
oemName = "Hanvon";
#elif defined(OEM_LISICHENG)
oemName = "Lanxum";
#else
oemName = "Huago";
#endif
return oemName;
}
static std::string GetCurrVersion(const std::string& appName)
{
std::string version = "0.0.0.0";
@ -432,87 +507,12 @@ static std::string GetCurrVersion(const std::string& appName)
return version;
}
static std::string GetOSName()
{
std::string osName;
#if defined(HG_CMP_MSC)
osName = "Windows";
#else
osName = "Linux";
FILE* fp = popen("cat /etc/issue | cut -d\' \' -f1", "r");
if (NULL != fp)
{
char buff[1024] = { 0 };
fread(buff, 1024, 1, fp);
int len = (int)strlen(buff);
for (int i = 0; i < len; ++i)
{
if (buff[i] == '\n')
buff[i] = '\0';
}
osName = buff;
pclose(fp);
}
#endif
return osName;
}
static std::string GetArchName()
{
std::string archName;
#if defined(HG_CMP_MSC)
#ifdef _WIN64
archName = "x64";
#else
archName = "x86";
#endif
#else
archName = "unknown";
FILE *fp = popen("arch", "r");
if (NULL != fp)
{
char buff[1024] = { 0 };
fread(buff, 1024, 1, fp);
int len = (int)strlen(buff);
for (int i = 0; i < len; ++i)
{
if (buff[i] == '\n')
buff[i] = '\0';
}
archName = buff;
pclose(fp);
}
#endif
return archName;
}
static std::string GetOemName()
{
std::string oemName;
#if defined(OEM_HANWANG)
oemName = "Hanvon";
#elif defined(OEM_LISICHENG)
oemName = "Lanxum";
#else
oemName = "Huago";
#endif
return oemName;
}
static bool Greater(const std::string& str1, const std::string& str2)
{
return str1 > str2;
}
static HGResult PostInfo(int type, const std::string& appName, const std::string& desc, const std::string& crashFileUrl,
static HGResult PostInfo(int type, const std::string& appName, const std::string& desc, const std::string& crashFileUrl,
const std::string& exceptionAddr, const std::string& feedbackInfo, const std::string& feedbackContact)
{
HGResult ret = HGBASE_ERR_FAIL;
@ -1276,7 +1276,7 @@ HGResult HGVersionMgrImpl::GetVersionList(const HGChar* appName, HGVersionInfo**
HGUInt count2 = (HGUInt)versionList.size();
HGVersionInfo *info2 = new HGVersionInfo[count2];
HGUInt index = 0;
std::list<VersionInfoImpl>::const_iterator iter;
for (iter = versionList.begin(); iter != versionList.end(); ++iter)
@ -1380,7 +1380,7 @@ void HGVersionMgrImpl::MsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointe
case MsgId_PostDeviceScanCountInfo:
{
PostDeviceScanCountInfoParam* param = (PostDeviceScanCountInfoParam*)msg->data;
::PostDeviceInfo(param->baseInfo.devName, param->baseInfo.devSN, param->baseInfo.devType,
::PostDeviceInfo(param->baseInfo.devName, param->baseInfo.devSN, param->baseInfo.devType,
param->baseInfo.devFW, 0, 0, param->scanCount, 0, 0, 0);
delete param;
}
@ -1437,4 +1437,4 @@ void HGVersionMgrImpl::MsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointe
}
break;
}
}
}