Fix crash when Linux tries to read file data from a folder.
@@ -127,6 +127,17 @@ bool32_t platform_read_file(const char *filename, void **out_data, size_t *out_s
if (file_picker_cache_read(filename, out_data, out_size))
return true;
#endif
+
+#if defined(SK_OS_LINUX)
+ // Linux thinks folders are files, but then fails in a bad way when
+ // treating them like files.
+ struct stat buffer;
+ if (stat(filename, &buffer) != 0 || (S_ISDIR(buffer.st_mode))) {
+ log_diagf("platform_read_file can't read folders: %s", filename);
+ return false;
+ }
+#endif
+
FILE *fp = fopen(filename, "rb");
if (fp == nullptr) {
log_diagf("platform_read_file can't find %s", filename);
