use stat to find out if the file is a directory or not since it's more portable

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3790 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-11-26 20:28:18 +00:00
parent 6c3ce8f436
commit ca624dc184

View file

@ -169,6 +169,7 @@ public:
#else
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
@ -182,10 +183,15 @@ public:
if (dip) {
dirent *dit;
while ((dit = ::readdir(dip))) {
if (dit->d_type == DT_DIR) {
dir_reader::add_dir(dit->d_name);
} else {
dir_reader::add_file(dit->d_name);
struct stat st;
string file = dir + PLATFORM_PATH_SEPARATOR_STR + dit->d_name;
if (!stat(file.c_str(), &st)) {
if (S_ISDIR(st.st_mode)) {
dir_reader::add_dir(dit->d_name);
} else {
dir_reader::add_file(dit->d_name);
}
}
}
::closedir(dip);