mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
games/NXDoom: Use dirent for glob implementation
NuttX has dirent, so the glob implementation can be used. This removes the warning for no native glob implementation. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
This commit is contained in:
parent
3f04a28cbd
commit
26c5dd8305
1 changed files with 3 additions and 37 deletions
|
|
@ -33,15 +33,10 @@
|
||||||
#include "i_glob.h"
|
#include "i_glob.h"
|
||||||
#include "m_misc.h"
|
#include "m_misc.h"
|
||||||
|
|
||||||
#if defined(HAVE_DIRENT_H)
|
#include <dirent.h>
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#elif defined(__WATCOMC__)
|
|
||||||
/* Watcom has the same API in a different header. */
|
|
||||||
#include <direct.h>
|
|
||||||
#else
|
|
||||||
#define NO_DIRENT_IMPLEMENTATION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
|
|
@ -72,8 +67,6 @@ struct glob_s
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef NO_DIRENT_IMPLEMENTATION
|
|
||||||
|
|
||||||
/* Only the fields d_name and (as an XSI extension) d_ino are specified
|
/* Only the fields d_name and (as an XSI extension) d_ino are specified
|
||||||
* in POSIX.1. Other than Linux, the d_type field is available mainly
|
* in POSIX.1. Other than Linux, the d_type field is available mainly
|
||||||
* only on BSD systems. The remaining fields are available on many, but
|
* only on BSD systems. The remaining fields are available on many, but
|
||||||
|
|
@ -95,7 +88,7 @@ static boolean is_directory(char *dir, struct dirent *de)
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
filename = m_string_join(dir, DIR_SEPARATOR_S, de->d_name, NULL);
|
filename = m_string_join(dir, DIR_SEPARATOR_S, de->d_name, NULL);
|
||||||
result = m_stat(filename, &sb);
|
result = stat(filename, &sb);
|
||||||
free(filename);
|
free(filename);
|
||||||
|
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
|
|
@ -402,30 +395,3 @@ const char *i_next_glob(glob_t *glob)
|
||||||
++glob->next_index;
|
++glob->next_index;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* #ifdef NO_DIRENT_IMPLEMENTATION */
|
|
||||||
|
|
||||||
#warning "No native implementation of file globbing."
|
|
||||||
|
|
||||||
glob_t *i_start_glob(const char *directory, const char *glob, int flags)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void i_end_glob(glob_t *glob)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *i_next_glob(glob_t *glob)
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
glob_t *i_start_multi_glob(const char *directory, int flags,
|
|
||||||
const char *glob, ...)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* NO_DIRENT_IMPLEMENTATION */
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue