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:
parent
6c3ce8f436
commit
ca624dc184
1 changed files with 10 additions and 4 deletions
|
@ -169,6 +169,7 @@ public:
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
|
@ -182,10 +183,15 @@ public:
|
||||||
if (dip) {
|
if (dip) {
|
||||||
dirent *dit;
|
dirent *dit;
|
||||||
while ((dit = ::readdir(dip))) {
|
while ((dit = ::readdir(dip))) {
|
||||||
if (dit->d_type == DT_DIR) {
|
struct stat st;
|
||||||
dir_reader::add_dir(dit->d_name);
|
string file = dir + PLATFORM_PATH_SEPARATOR_STR + dit->d_name;
|
||||||
} else {
|
|
||||||
dir_reader::add_file(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);
|
::closedir(dip);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue