filesystem: wscript: check d_type field in struct dirent, as this is an extension and some supported ports (like psvita) don't have it
This commit is contained in:
parent
1907485895
commit
d4fe3d6f8a
2 changed files with 10 additions and 1 deletions
|
@ -261,9 +261,10 @@ void listdirectory( stringlist_t *list, const char *path, qboolean dirs_only )
|
||||||
// iterate through the directory
|
// iterate through the directory
|
||||||
while(( entry = readdir( dir )))
|
while(( entry = readdir( dir )))
|
||||||
{
|
{
|
||||||
// FIXME: this is a BSD extension, add check to wscript
|
#if HAVE_DIRENT_D_TYPE
|
||||||
if( dirs_only && entry->d_type != DT_DIR && entry->d_type != DT_UNKNOWN )
|
if( dirs_only && entry->d_type != DT_DIR && entry->d_type != DT_UNKNOWN )
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
stringlistappend( list, entry->d_name );
|
stringlistappend( list, entry->d_name );
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,11 @@ MEMFD_CREATE_TEST = '''#define _GNU_SOURCE
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
int main(int argc, char **argv) { return memfd_create(argv[0], 0); }'''
|
int main(int argc, char **argv) { return memfd_create(argv[0], 0); }'''
|
||||||
|
|
||||||
|
DIRENT_D_TYPE_TEST = '''#define _GNU_SOURCE
|
||||||
|
#include <dirent.h>
|
||||||
|
int main(int argc, char **argv) { struct dirent entry; entry.d_type = DT_DIR; return 0; }
|
||||||
|
'''
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -18,6 +23,9 @@ def configure(conf):
|
||||||
if conf.check_cc(fragment=MEMFD_CREATE_TEST, msg='Checking for memfd_create', mandatory=False):
|
if conf.check_cc(fragment=MEMFD_CREATE_TEST, msg='Checking for memfd_create', mandatory=False):
|
||||||
conf.define('HAVE_MEMFD_CREATE', 1)
|
conf.define('HAVE_MEMFD_CREATE', 1)
|
||||||
|
|
||||||
|
if conf.check_cc(fragment=DIRENT_D_TYPE_TEST, msg='Checking for d_type field in struct dirent', mandatory=False):
|
||||||
|
conf.define('HAVE_DIRENT_D_TYPE', 1)
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
bld(name = 'filesystem_includes', export_includes = '.')
|
bld(name = 'filesystem_includes', export_includes = '.')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue