From f9a4b537c83ba27fcba6a5e9e545e3db704a2e66 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 28 Apr 2024 15:22:37 +0200 Subject: [PATCH] Skip stat if _DIRENT_HAVE_D_STAT is set --- src/FSWrapper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/FSWrapper.cpp b/src/FSWrapper.cpp index c271e9a..bbb1120 100644 --- a/src/FSWrapper.cpp +++ b/src/FSWrapper.cpp @@ -98,6 +98,9 @@ FSError FSWrapper::FSReadDirWrapper(FSDirectoryHandle handle, FSDirectoryEntry * if (strcmp(entry_->d_name, ".") == 0 || strcmp(entry_->d_name, "..") == 0) { entry->info.size = 0; } else { +#ifdef _DIRENT_HAVE_D_STAT + translate_stat(&entry_->d_stat, &entry->info); +#else struct stat sb {}; auto path = string_format("%s/%s", dirHandle->path, entry_->d_name); std::replace(path.begin(), path.end(), '\\', '/'); @@ -120,6 +123,7 @@ FSError FSWrapper::FSReadDirWrapper(FSDirectoryHandle handle, FSDirectoryEntry * result = FS_ERROR_MEDIA_ERROR; break; } +#endif } } result = FS_ERROR_OK;