解决HGVersion在kylin系统上获取版本号不正确的问题
This commit is contained in:
parent
c96484dfae
commit
b3eaba6fc4
|
@ -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,81 +507,6 @@ 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;
|
||||
|
|
Loading…
Reference in New Issue