From 9e6c5f0b905f5cb84471b89af99ea2ad8d7299ce Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Tue, 9 Dec 2008 14:46:46 +0000 Subject: [PATCH] OS-independent way to detect presence of dirent.d_type - suggested by Bill Oliver --- configure.in | 4 ++++ src/config/ScanDir.cpp | 11 +++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/configure.in b/configure.in index 45d9b60cd9..26f4f7484c 100644 --- a/configure.in +++ b/configure.in @@ -700,6 +700,10 @@ AC_CHECK_TYPES([struct XDR::xdr_ops],,,[#include AC_CHECK_TYPES([struct xdr_ops],,,[#include #include ]) +dnl AC_STRUCT_DIRENT_D_TYPE +AC_CHECK_MEMBER([struct dirent.d_type], + AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE,1,[Define this if struct dirent has d_type]),, + [#include ]) dnl EKU: try to determine the alignment of long and double dnl replaces FB_ALIGNMENT and FB_DOUBLE_ALIGN in src/jrd/common.h diff --git a/src/config/ScanDir.cpp b/src/config/ScanDir.cpp index 8f86e62b16..6b0a143257 100644 --- a/src/config/ScanDir.cpp +++ b/src/config/ScanDir.cpp @@ -146,16 +146,11 @@ bool ScanDir::match(const char *pattern, const char *name) bool ScanDir::isDirectory() { -#ifdef _WIN32 +#if defined(_WIN32) return (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; +#elif defined(HAVE_STRUCT_DIRENT_D_TYPE) + return (data->d_type == DT_DIR); #else -#ifndef SOLARIS -#ifndef HPUX - if (data->d_type == DT_DIR) - return true; -#endif -#endif - struct stat buf; if (stat (getFilePath(), &buf))