When trying to compile a current cvs-checkout
(14.11.02) on a sparc solaris machine, the file
posix-fs can not be compiled, because the solaris
dirent-structure does not have a member called d_type:
c++ -Wp,-MMD,"backends/fs/posix/.deps/posix-fs.d2" -g
-O -Wall -Wstrict-prototypes -Wuninitialized
-Wno-long-long -Wno-multichar -Wno-unknown-pragmas
-DUNIX -DUSE_MAD -DSIMONDEBUG -I. -Icommon `sdl-config
--cflags` -c backends/fs/posix/posix-fs.cpp -o
backends/fs/posix/posix-fs.o
backends/fs/posix/posix-fs.cpp: In method `class FSList
* POSIXFilesystemNode::listDir() const':
backends/fs/posix/posix-fs.cpp:102: `struct dirent' has
no member named `d_type'
backends/fs/posix/posix-fs.cpp:102: `DT_DIR' undeclared
(first use this function)
backends/fs/posix/posix-fs.cpp:102: (Each undeclared
identifier is reported only once
backends/fs/posix/posix-fs.cpp:102: for each function
it appears in.)
gmake: *** [backends/fs/posix/posix-fs.o] Error 1
When replacing the line with a stat-call and then
checking for a directory, scummvm compiles:
#include <sys/stat.h>
...
struct stat dstat;
...
stat(dp->d_name,&dstat);
entry._isDirectory =
S_ISDIR(dstat.st_mode);
But I do not believe this is a clean (or even working
as intended) solution.
Ticket imported from: #638641. Ticket imported from: bugs/568.
From what I understand, d_type is a BSD extension to struct dirent, so using stat() may be the only portable way to check if a filename points to a directory or not.