Avoid calling stat() after readdir() on Windows as we already have what we want
This commit is contained in:
@@ -103,7 +103,13 @@ struct dirent *readdir(DIR *dir)
|
||||
if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)
|
||||
{
|
||||
result = &dir->result;
|
||||
result->d_mtime = dir->info.time_write;
|
||||
result->d_size = dir->info.size;
|
||||
result->d_name = dir->info.name;
|
||||
if (dir->info.attrib & _A_SUBDIR)
|
||||
result->d_mode = S_IFDIR;
|
||||
else
|
||||
result->d_mode = S_IFREG;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -21,6 +21,12 @@ typedef struct DIR DIR;
|
||||
struct dirent
|
||||
{
|
||||
char *d_name;
|
||||
// The native call we use, findfirst/next return file attributes at once,
|
||||
// no need for a separate stat() call in most cases
|
||||
// Note that ctime is actually creation time. No use for posix.
|
||||
time_t d_mtime;
|
||||
off_t d_size;
|
||||
int d_mode; // S_IFREG or S_IFDIR only
|
||||
};
|
||||
|
||||
DIR *opendir(const char *);
|
||||
|
||||
Reference in New Issue
Block a user