diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-11-30 09:56:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-30 10:05:21 +0300 |
commit | 28d2148b09a2d975876f4418bd5ba15ab5edea8d (patch) | |
tree | 0be71dfc4a7404ec33608958f1ed34c3e7d5914a /source/blender | |
parent | fa3d50af95fde76ef08590d2f86444f2f9fdca95 (diff) |
Haiku OS Support
D2860 by @miqlas
Even though Haiku is a niche OS, only minor changes are needed.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_sys_types.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 16 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_sys_types.h b/source/blender/blenlib/BLI_sys_types.h index 9477f61713c..80ee50621ca 100644 --- a/source/blender/blenlib/BLI_sys_types.h +++ b/source/blender/blenlib/BLI_sys_types.h @@ -47,7 +47,9 @@ extern "C" { #endif -#if defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__) +#if defined(__linux__) || defined(__GNU__) || \ + defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) || \ + defined(__HAIKU__) /* Linux-i386, Linux-Alpha, Linux-ppc */ #include <stdint.h> diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 36a0d1c1641..ad53457f863 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -621,7 +621,21 @@ static int recursive_operation(const char *startfrom, const char *startto, if (to) join_dirfile_alloc(&to_path, &to_alloc_len, to, dirent->d_name); - if (dirent->d_type == DT_DIR) { + bool is_dir; + +#ifdef __HAIKU__ + { + struct stat st_dir; + char filename[FILE_MAX]; + BLI_path_join(filename, sizeof(filename), startfrom, dirent->d_name, NULL); + lstat(filename, &st_dir); + is_dir = S_ISDIR(st_dir.st_mode); + } +#else + is_dir = (dirent->d_type == DT_DIR); +#endif + + if (is_dir) { /* recursively dig into a subfolder */ ret = recursive_operation(from_path, to_path, callback_dir_pre, callback_file, callback_dir_post); } diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index e31659c35d9..c08329ef34f 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -37,7 +37,7 @@ #include <sys/stat.h> -#if defined(__NetBSD__) || defined(__DragonFly__) +#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__HAIKU__) /* Other modern unix os's should probably use this also */ # include <sys/statvfs.h> # define USE_STATFS_STATVFS |