mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-28 02:41:12 +00:00
commit
8db2b4a9ae
@ -187,6 +187,7 @@ uint32_t GetUintParameter(const char *key, uint32_t def);
|
||||
const char *GetDistributionOSName(void);
|
||||
const char *GetDistributionOSVersion(void);
|
||||
int GetDistributionOSApiVersion(void);
|
||||
const char *GetDistributionOSApiName(void);
|
||||
const char *GetDistributionOSReleaseType(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -147,6 +147,7 @@
|
||||
GetDistributionOSName;
|
||||
GetDistributionOSVersion;
|
||||
GetDistributionOSApiVersion;
|
||||
GetDistributionOSApiName;
|
||||
GetDistributionOSReleaseType;
|
||||
SaveParameters;
|
||||
OH_StrArrayGetIndex;
|
||||
|
@ -397,6 +397,15 @@ int GetDistributionOSApiVersion(void)
|
||||
}
|
||||
return atoi(distributionOsApiVersion);
|
||||
}
|
||||
const char *GetDistributionOSApiName(void)
|
||||
{
|
||||
static const char *distributionOsApiName = NULL;
|
||||
GetProperty("const.product.os.dist.apiname", &distributionOsApiName);
|
||||
if (distributionOsApiName == NULL) {
|
||||
distributionOsApiName = EMPTY_STR;
|
||||
}
|
||||
return distributionOsApiName;
|
||||
}
|
||||
|
||||
const char *GetDistributionOSReleaseType(void)
|
||||
{
|
||||
|
@ -420,6 +420,15 @@ static napi_value NAPI_GetDistributionOSApiVersion(napi_env env, napi_callback_i
|
||||
return napiValue;
|
||||
}
|
||||
|
||||
static napi_value NAPI_GetDistributionOSApiName(napi_env env, napi_callback_info info)
|
||||
{
|
||||
napi_value napiValue = nullptr;
|
||||
const char *val = GetDistributionOSApiName();
|
||||
|
||||
NAPI_CALL(env, napi_create_string_utf8(env, val, strlen(val), &napiValue));
|
||||
return napiValue;
|
||||
}
|
||||
|
||||
static napi_value NAPI_GetDistributionOSReleaseType(napi_env env, napi_callback_info info)
|
||||
{
|
||||
napi_value napiValue = nullptr;
|
||||
@ -523,6 +532,7 @@ static napi_value Init(napi_env env, napi_value exports)
|
||||
{"distributionOSName", nullptr, nullptr, NAPI_GetDistributionOSName, nullptr, nullptr, napi_default, nullptr},
|
||||
{"distributionOSVersion", nullptr, nullptr, NAPI_GetDistributionOSVersion, nullptr, nullptr, napi_default, nullptr},
|
||||
{"distributionOSApiVersion", nullptr, nullptr, NAPI_GetDistributionOSApiVersion, nullptr, nullptr, napi_default, nullptr},
|
||||
{"distributionOSApiName", nullptr, nullptr, NAPI_GetDistributionOSApiName, nullptr, nullptr, napi_default, nullptr},
|
||||
{"distributionOSReleaseType", nullptr, nullptr, NAPI_GetDistributionOSReleaseType, nullptr, nullptr, napi_default, nullptr},
|
||||
{"ODID", nullptr, nullptr, GetDevOdid, nullptr, nullptr, napi_default, nullptr},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user