XboxDev / nxdk

The cross-platform, open-source SDK to develop for original Xbox: *new* xdk
445 stars 68 forks source link

Missing sys/stat.h #464

Open JayFoxRox opened 3 years ago

JayFoxRox commented 3 years ago

Here's a hack I've been using locally:

echo "#pragma once // Generated" > $NXDK_DIR/lib/xboxrt/libc_extensions/sys/stat.h
echo "#include <stddef.h>" >> $NXDK_DIR/lib/xboxrt/libc_extensions/sys/stat.h
echo "struct _stat { size_t st_size; int st_mode; int st_mtime; int st_atime; int st_nlink; };" >> $NXDK_DIR/lib/xboxrt/libc_extensions/sys/stat.h
echo "struct _stati64 { size_t st_size; int st_mode; int st_mtime; int st_atime; int st_nlink; };" >> $NXDK_DIR/lib/xboxrt/libc_extensions/sys/stat.h
echo "static int _stati64(const char* x, ...) { return 0; };" >> $NXDK_DIR/lib/xboxrt/libc_extensions/sys/stat.h

I hope that someone will implement this properly.

There's more functionality in this, but this is enough for my current projects

LukeUsher commented 2 years ago

My view on this would be that we shouldn’t fix this: sys/stat.h is a POSIX/UNIX api and should not be assumed to be present in non-posix environments such as Xbox.

glebm commented 2 years ago

Yeah I agree, will fix this on DevilutionX side (same for sys/types.h)

I initially was under the wrong impression that NXDK aims to be somewhat POSIX compatible