Get CPU arch

This commit is contained in:
Aoran Zeng
2024-06-21 10:55:43 +08:00
parent 984aa6b323
commit fcb74cb2ef
2 changed files with 39 additions and 8 deletions

View File

@@ -7,7 +7,7 @@
* Contributors : Null Nil <null@nil.com>
* |
* Created on : <2023-08-29>
* Last modified : <2024-06-14>
* Last modified : <2024-06-21>
*
* chsrc 头文件
* ------------------------------------------------------------*/
@@ -710,6 +710,37 @@ chsrc_backup (const char *path)
}
static char *
chsrc_get_cpuarch ()
{
char *ret;
bool exist;
if (xy_on_windows)
{
xy_unimplement;
}
exist = chsrc_check_program ("arch");
if (exist)
{
ret = xy_run ("arch", 0, NULL);
return ret;
}
exist = chsrc_check_program ("uname");
if (exist)
{
ret = xy_run ("uname -p", 0, NULL);
return ret;
}
else
{
chsrc_error ("无法检测到CPU类型");
exit (Exit_UserCause);
}
}
/* Target Info */
typedef struct TargetInfo_t {