diff --git a/crnlib/Makefile b/crnlib/Makefile index 9a9de187..8d2dfcec 100644 --- a/crnlib/Makefile +++ b/crnlib/Makefile @@ -51,7 +51,6 @@ OBJECTS = \ crn_utils.o \ crn_value.o \ crn_vector.o \ - crn_zeng.o \ crn_texture_comp.o \ crn_texture_conversion.o \ crn_dds_comp.o \ diff --git a/crnlib/crn_find_files.cpp b/crnlib/crn_find_files.cpp index 1c3f7fd5..1ae097ad 100644 --- a/crnlib/crn_find_files.cpp +++ b/crnlib/crn_find_files.cpp @@ -9,8 +9,12 @@ #include "crn_winhdr.h" #elif defined(__GNUC__) +#include #include #include +#include +#include +#include #endif namespace crnlib { @@ -195,6 +199,8 @@ bool find_files::find_internal(const char* pBasepath, const char* pRelpath, cons if (!dp) return level ? true : false; + const int dirDesc = dirfd(dp); + dynamic_string_array paths; for (;;) { @@ -204,8 +210,25 @@ bool find_files::find_internal(const char* pBasepath, const char* pRelpath, cons if ((strcmp(ep->d_name, ".") == 0) || (strcmp(ep->d_name, "..") == 0)) continue; - const bool is_directory = (ep->d_type & DT_DIR) != 0; - const bool is_file = (ep->d_type & DT_REG) != 0; + bool is_directory = false, is_file = false; + + if (ep->d_type != DT_UNKNOWN) + { + is_directory = (ep->d_type & DT_DIR) != 0; + is_file = (ep->d_type & DT_REG) != 0; + } + else + { + struct stat st; + if (fstatat(dirDesc, ep->d_name, &st, AT_SYMLINK_NOFOLLOW) == 0) + { + is_directory = (st.st_mode & S_IFDIR) != 0; + is_file = (st.st_mode & S_IFREG) != 0; + } + } + + if (!is_directory && !is_file) + continue; dynamic_string filename(ep->d_name); diff --git a/crnlib/crnlib.cbp b/crnlib/crnlib.cbp index fe9354e1..aeb67e49 100644 --- a/crnlib/crnlib.cbp +++ b/crnlib/crnlib.cbp @@ -189,8 +189,6 @@ - - diff --git a/crnlib/crnlib_linux.cbp b/crnlib/crnlib_linux.cbp index 2b68e926..bfe30306 100644 --- a/crnlib/crnlib_linux.cbp +++ b/crnlib/crnlib_linux.cbp @@ -189,8 +189,6 @@ - -