mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
00f7db376c
* dir.c (glob_helper): use d_type to reduce lstat system calls. * win32/dir.h (struct direct): add d_type instead of d_isdir and d_isrep. SYMLINKD is unreliable, since the target can be replaced after a link was created. * win32/win32.c (readdir_internal): set d_type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
#ifndef RUBY_WIN32_DIR_H
|
|
#define RUBY_WIN32_DIR_H
|
|
|
|
#ifdef __BORLANDC__
|
|
# ifndef WIN32_DIR_H_
|
|
# define WIN32_DIR_H_
|
|
# include <sys/types.h>
|
|
# endif
|
|
#endif
|
|
|
|
#define DT_UNKNOWN 0
|
|
#define DT_DIR (S_IFDIR>>12)
|
|
#define DT_REG (S_IFREG>>12)
|
|
#define DT_LNK 10
|
|
|
|
struct direct
|
|
{
|
|
long d_namlen;
|
|
ino_t d_ino;
|
|
char *d_name;
|
|
char *d_altname; /* short name */
|
|
short d_altlen;
|
|
uint8_t d_type;
|
|
};
|
|
typedef struct {
|
|
WCHAR *start;
|
|
WCHAR *curr;
|
|
long size;
|
|
long nfiles;
|
|
long loc; /* [0, nfiles) */
|
|
struct direct dirstr;
|
|
char *bits; /* used for d_isdir and d_isrep */
|
|
} DIR;
|
|
|
|
|
|
DIR* rb_w32_opendir(const char*);
|
|
DIR* rb_w32_uopendir(const char*);
|
|
struct direct* rb_w32_readdir(DIR *, rb_encoding *);
|
|
long rb_w32_telldir(DIR *);
|
|
void rb_w32_seekdir(DIR *, long);
|
|
void rb_w32_rewinddir(DIR *);
|
|
void rb_w32_closedir(DIR *);
|
|
|
|
#define opendir(s) rb_w32_opendir((s))
|
|
#define readdir(d) rb_w32_readdir((d), 0)
|
|
#define telldir(d) rb_w32_telldir((d))
|
|
#define seekdir(d, l) rb_w32_seekdir((d), (l))
|
|
#define rewinddir(d) rb_w32_rewinddir((d))
|
|
#define closedir(d) rb_w32_closedir((d))
|
|
|
|
#endif /* RUBY_WIN32_DIR_H */
|