summaryrefslogtreecommitdiff
path: root/drivers/unix/dir_access_unix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/unix/dir_access_unix.cpp')
-rw-r--r--drivers/unix/dir_access_unix.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 251bab5783..d5582d00ed 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -136,27 +136,31 @@ String DirAccessUnix::get_next() {
return "";
}
- //typedef struct stat Stat;
- struct stat flags;
-
String fname = fix_unicode_name(entry->d_name);
- String f = current_dir.plus_file(fname);
+ if (entry->d_type == DT_UNKNOWN) {
+ //typedef struct stat Stat;
+ struct stat flags;
+
+ String f = current_dir.plus_file(fname);
+
+ if (stat(f.utf8().get_data(), &flags) == 0) {
- if (stat(f.utf8().get_data(), &flags) == 0) {
+ if (S_ISDIR(flags.st_mode)) {
- if (S_ISDIR(flags.st_mode)) {
+ _cisdir = true;
- _cisdir = true;
+ } else {
+
+ _cisdir = false;
+ }
} else {
_cisdir = false;
}
-
} else {
-
- _cisdir = false;
+ _cisdir = (entry->d_type == DT_DIR);
}
_cishidden = (fname != "." && fname != ".." && fname.begins_with("."));