Updated platform utils to Linux
#include <errno.h>
#endif
+#if __linux__
+#include <unistd.h>
+#endif
+
namespace sk {
///////////////////////////////////////////
@@ -104,8 +108,8 @@ bool platform_read_file(const char *filename, void **out_data, size_t *out_size)
}
#elif __linux__
- FILE *fp;
- if (fopen(&fp, filename, "rb") != 0 || fp == nullptr) {
+ FILE *fp = fopen(filename, "rb");
+ if (fp == nullptr) {
log_errf("Can't find file %s!", filename);
return false;
}
@@ -198,13 +202,15 @@ bool platform_key_down(key_ key) {
void platform_debug_output(log_ level, const char *text) {
#if _WIN32
OutputDebugStringA(text);
-#else
+#elif defined(__ANDROID__)
int32_t priority = ANDROID_LOG_INFO;
if (level == log_diagnostic) priority = ANDROID_LOG_VERBOSE;
else if (level == log_inform ) priority = ANDROID_LOG_INFO;
else if (level == log_warning ) priority = ANDROID_LOG_WARN;
else if (level == log_error ) priority = ANDROID_LOG_ERROR;
__android_log_write(priority, "StereoKit", text);
+#else
+ printf("%s", text);
#endif
}
@@ -213,6 +219,8 @@ void platform_debug_output(log_ level, const char *text) {
void platform_sleep(int ms) {
#ifdef _WIN32
Sleep(ms);
+#elif defined(__linux__)
+ sleep(ms * 1000);
#else
usleep(ms * 1000);
#endif
