minecraft-pi-reborn/mods/src/readdir/readdir.c

23 lines
564 B
C
Raw Normal View History

2020-09-25 16:43:53 +00:00
#define __USE_LARGEFILE64
#include <stddef.h>
#include <stdint.h>
#include <dirent.h>
2020-10-26 19:58:28 +00:00
// Minecraft: Pi Edition Was Not Compiled With 64-Bit Filesystem Support, So This Shims readdir() To Read Directories Properly
2020-09-25 16:43:53 +00:00
#define FILENAME_SIZE 256
2020-11-08 03:26:22 +00:00
struct dirent *readdir(DIR *dirp) {
2020-09-25 16:43:53 +00:00
struct dirent64 *original = readdir64(dirp);
if (original == NULL) {
return NULL;
}
static struct dirent new;
for (int i = 0; i < FILENAME_SIZE; i++) {
new.d_name[i] = original->d_name[i];
}
new.d_type = original->d_type;
return &new;
}