Basic MacOS support

This commit is contained in:
Linus Dierheimer
2022-09-04 09:02:11 -07:00
parent 475099696f
commit 71779fa4b1
7 changed files with 141 additions and 12 deletions
+18 -1
View File
@@ -357,4 +357,21 @@ void ffSettingsGetAndroidProperty(const char* propName, FFstrbuf* result) {
result->length += (uint32_t) __system_property_get(propName, result->chars + result->length);
result->chars[result->length] = '\0';
}
#endif
#endif //__ANDROID__
#ifdef __APPLE__
#include <sys/sysctl.h>
void ffSettingsGetAppleProperty(const char* propName, FFstrbuf* result)
{
size_t neededLength;
if(sysctlbyname(propName, NULL, &neededLength, NULL, 0) != 0 || neededLength == 0)
return;
ffStrbufEnsureFree(result, (uint32_t) neededLength);
if(sysctlbyname(propName, result->chars + result->length, &neededLength, NULL, 0) == 0)
result->length += (uint32_t) neededLength;
result->chars[result->length] = '\0';
}
#endif //__APPLE__
+4
View File
@@ -36,4 +36,8 @@ int ffSettingsGetSQLite3Int(const FFinstance* instance, const char* dbPath, cons
void ffSettingsGetAndroidProperty(const char* propName, FFstrbuf* result);
#endif
#ifdef __APPLE__
void ffSettingsGetAppleProperty(const char* propName, FFstrbuf* result);
#endif
#endif