diff -Naur zaz-1.0.0/src/directorylister.cpp zaz-1.0.0-haiku/src/directorylister.cpp
|
old
|
new
|
|
| 19 | 19 | #include "directorylister.h" |
| 20 | 20 | #ifndef WIN32 |
| 21 | 21 | |
| | 22 | #ifndef DT_DIR |
| | 23 | /* dirent.d_type is a BSD extension, not part of POSIX */ |
| | 24 | #include <dirent.h> |
| 22 | 25 | #include <sys/stat.h> |
| | 26 | #include <string.h> |
| | 27 | |
| | 28 | static int |
| | 29 | is_dir (const char *path, const char *name) |
| | 30 | { |
| | 31 | int len1 = strlen(path); |
| | 32 | int len2 = strlen(name); |
| | 33 | |
| | 34 | char pathname[len1 + 1 + len2 + 1 + 13]; |
| | 35 | strcpy (pathname, path); |
| | 36 | |
| | 37 | /* Avoid UNC-path "//name" on Cygwin. */ |
| | 38 | if (len1 > 0 && pathname[len1 - 1] != '/') |
| | 39 | strcat (pathname, "/"); |
| | 40 | |
| | 41 | strcat (pathname, name); |
| | 42 | |
| | 43 | struct stat st; |
| | 44 | if (stat (pathname, &st)) |
| | 45 | return 0; |
| | 46 | return S_ISDIR (st.st_mode); |
| | 47 | } |
| | 48 | #endif |
| 23 | 49 | |
| 24 | 50 | vector<string> ListFiles(string dir, const string extension) |
| 25 | 51 | { |
| … |
… |
|
| 34 | 60 | { |
| 35 | 61 | bool isFile = false; |
| 36 | 62 | |
| 37 | | if (file->d_type == DT_REG) |
| | 63 | if (is_dir (dir.c_str(), file->d_name)) |
| 38 | 64 | isFile = true; |
| 39 | 65 | |
| 40 | 66 | if (!isFile) |