mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-04 22:18:55 +02:00
104 lines
2.3 KiB
Plaintext
104 lines
2.3 KiB
Plaintext
From 818adc5bba3ee6963f320bdfdfd19b268fe71044 Mon Sep 17 00:00:00 2001
|
|
From: miqlas <zmizsei@extrowerk.com>
|
|
Date: Sun, 31 Jul 2016 12:51:31 +0200
|
|
Subject: [PATCH] Haiku Fix
|
|
|
|
---
|
|
src/core/poll_manager.cc | 4 ++++
|
|
src/input/path_input.cc | 12 +++++++++++-
|
|
src/utils/directory.cc | 9 +++++++++
|
|
src/utils/directory.h | 4 ++++
|
|
4 files changed, 28 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/core/poll_manager.cc b/src/core/poll_manager.cc
|
|
index 1a3a0a5..741dd7e 100644
|
|
--- a/src/core/poll_manager.cc
|
|
+++ b/src/core/poll_manager.cc
|
|
@@ -48,6 +48,10 @@
|
|
#include "manager.h"
|
|
#include "poll_manager.h"
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <sys/select.h>
|
|
+#endif
|
|
+
|
|
namespace core {
|
|
|
|
torrent::Poll*
|
|
diff --git a/src/input/path_input.cc b/src/input/path_input.cc
|
|
index fa8afda..55a09da 100644
|
|
--- a/src/input/path_input.cc
|
|
+++ b/src/input/path_input.cc
|
|
@@ -48,6 +48,12 @@
|
|
|
|
#include "path_input.h"
|
|
|
|
+#ifndef DT_DIR
|
|
+/* dirent.d_type is a BSD extension, not part of POSIX */
|
|
+#include <sys/stat.h>
|
|
+#include <dirent.h>
|
|
+#endif
|
|
+
|
|
namespace input {
|
|
|
|
PathInput::PathInput() :
|
|
@@ -75,7 +81,11 @@ PathInput::pressed(int key) {
|
|
|
|
struct _transform_filename {
|
|
void operator () (utils::directory_entry& entry) {
|
|
- if (entry.d_type == DT_DIR)
|
|
+ #ifdef __HAIKU__
|
|
+ if (S_ISDIR(entry.d_type))
|
|
+ #else
|
|
+ if (entry.d_type == DT_DIR)
|
|
+ #endif
|
|
entry.d_name += '/';
|
|
}
|
|
};
|
|
diff --git a/src/utils/directory.cc b/src/utils/directory.cc
|
|
index f934aeb..73d23f9 100644
|
|
--- a/src/utils/directory.cc
|
|
+++ b/src/utils/directory.cc
|
|
@@ -46,6 +46,10 @@
|
|
|
|
#include "directory.h"
|
|
|
|
+#ifdef __HAIKU__
|
|
+struct stat st;
|
|
+#endif
|
|
+
|
|
namespace utils {
|
|
|
|
// Keep this?
|
|
@@ -89,7 +93,12 @@ Directory::update(int flags) {
|
|
#else
|
|
itr->d_fileno = entry->d_fileno;
|
|
itr->d_reclen = entry->d_reclen;
|
|
+ #ifdef __HAIKU__
|
|
+ lstat(rak::path_expand(m_path).c_str(), &st);
|
|
+ itr->d_type = st.st_mode;
|
|
+ #else
|
|
itr->d_type = entry->d_type;
|
|
+ #endif
|
|
#endif
|
|
|
|
#ifdef DIRENT_NAMLEN_EXISTS_FOOBAR
|
|
diff --git a/src/utils/directory.h b/src/utils/directory.h
|
|
index ec8027b..f11a418 100644
|
|
--- a/src/utils/directory.h
|
|
+++ b/src/utils/directory.h
|
|
@@ -41,6 +41,10 @@
|
|
#include <vector>
|
|
#include <inttypes.h>
|
|
|
|
+#ifdef __HAIKU__
|
|
+#define d_fileno d_ino
|
|
+#endif
|
|
+
|
|
namespace utils {
|
|
|
|
struct directory_entry {
|
|
--
|
|
2.7.0
|
|
|