Merge pull request #30657 from hadrien-psydk/optimize_dir_access_unix_get_next

Optimize DirAccessUnix::get_next() for some file systems
This commit is contained in:
Rémi Verschelde 2019-07-17 21:14:26 +02:00 committed by GitHub
commit fa4cb80a1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,11 +136,12 @@ String DirAccessUnix::get_next() {
return ""; return "";
} }
String fname = fix_unicode_name(entry->d_name);
if (entry->d_type == DT_UNKNOWN) {
//typedef struct stat Stat; //typedef struct stat Stat;
struct stat flags; struct stat flags;
String fname = fix_unicode_name(entry->d_name);
String f = current_dir.plus_file(fname); String f = current_dir.plus_file(fname);
if (stat(f.utf8().get_data(), &flags) == 0) { if (stat(f.utf8().get_data(), &flags) == 0) {
@ -158,6 +159,9 @@ String DirAccessUnix::get_next() {
_cisdir = false; _cisdir = false;
} }
} else {
_cisdir = (entry->d_type == DT_DIR);
}
_cishidden = (fname != "." && fname != ".." && fname.begins_with(".")); _cishidden = (fname != "." && fname != ".." && fname.begins_with("."));