Filetype from dirent.h

I started porting W2C2 as a short-term replacement for Wasmer but its wrapper for the fd_readdir() command within the WASI standard uses a field in the dirent struct called d_type that is implemented in Linux and OpenBSD but not Haiku. Is there another function call that will do the equivalent? If your search-fu is better than mine, a link will do. I’ve been searching for about a half-hour now. The Linux manual mentions the lstat command but it doesn’t look like what I’m looking for. (Or at least I don’t think so.)

lstat is the fallback, see c - Checking if a dir. entry returned by readdir is a directory, link or file. dent->d_type isn't showing the type - Stack Overflow

1 Like

Thanks! Now that I recognize that some filesystems in Linux don’t even implement that field, I can fix that bug as well as make it Haiku compatible.