Skip to content

Commit ab20588

Browse files
quic-dengkailrpavlik
authored andcommitted
platform_utils: Add PlatformUtilsGetBoolSysProp
1 parent 8fb9c94 commit ab20588

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/common/platform_utils.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,16 @@ static inline std::string PlatformUtilsGetSecureEnv(const char* /* name */) {
342342
return {};
343343
}
344344

345+
static inline bool PlatformUtilsGetBoolSysProp(const char* name, bool default_value) {
346+
bool result = default_value;
347+
char value[PROP_VALUE_MAX] = {};
348+
if (__system_property_get(name, value) != 0) {
349+
result = (value[0] == 't');
350+
}
351+
352+
return result;
353+
}
354+
345355
// Intended to be only used as a fallback on Android, with a more open, "native" technique used in most cases
346356
static inline bool PlatformGetGlobalRuntimeFileName(uint16_t major_version, std::string& file_name) {
347357
// Prefix for the runtime JSON file name

0 commit comments

Comments
 (0)