From e10734c005f4be56b001dbdc50cec014947a73f2 Mon Sep 17 00:00:00 2001 From: Carsten Larsen Date: Thu, 2 Feb 2017 22:58:07 +0100 Subject: [PATCH] Haiku support --- app/system/filesystem_stdc.cpp | 6 +++++- app/system/language_posix.h | 1 + app/system/preferences_stdc.cpp | 6 +++--- app/system/task_stdc.cpp | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/system/filesystem_stdc.cpp b/app/system/filesystem_stdc.cpp index f8445867..71eee1da 100755 --- a/app/system/filesystem_stdc.cpp +++ b/app/system/filesystem_stdc.cpp @@ -38,7 +38,7 @@ CharBuffer* StandardFilesystem::ListDirectory(const char *path) { -#ifdef UNIX +#if defined(UNIX) || defined(HAIKU) CharBuffer *pathbuf = new CharBuffer(); pathbuf->Empty(); if (path == NOMEM) { @@ -82,6 +82,9 @@ CharBuffer* StandardFilesystem::ListDirectory(const char *path) const char *type; +#ifdef HAIKU + type = TXTLISTDIRTUNKNOWN; +#else switch (entry->d_type) { case DT_REG: type = TXTLISTDIRTFILE; @@ -92,6 +95,7 @@ CharBuffer* StandardFilesystem::ListDirectory(const char *path) default: type = TXTLISTDIRTUNKNOWN; } +#endif const unsigned short colsize = 12; unsigned int a = StrLen(type) > colsize ? colsize : StrLen(type); diff --git a/app/system/language_posix.h b/app/system/language_posix.h index a1de6e1e..22b1cc20 100644 --- a/app/system/language_posix.h +++ b/app/system/language_posix.h @@ -27,6 +27,7 @@ #ifndef _LANGUAGE_POSIX_H #define _LANGUAGE_POSIX_H +#include "clib.h" #include "localize/lex.h" #include "localize/help.h" #include "localize/text.h" diff --git a/app/system/preferences_stdc.cpp b/app/system/preferences_stdc.cpp index 964a6c90..2e2f35e8 100644 --- a/app/system/preferences_stdc.cpp +++ b/app/system/preferences_stdc.cpp @@ -33,7 +33,7 @@ #include #include -#ifdef UNIX +#if defined(UNIX) && defined(HAIKU) static const char *tempname = "/tmp/amath.prefs"; static const char *permname = "/usr/local/etc/amath.conf"; #else @@ -43,7 +43,7 @@ static const char *permname = "amath.conf"; bool StandardPreferences::Load() { -#ifdef UNIX +#if defined(UNIX) && defined(HAIKU) FILE *file = fopen(tempname, "r"); if (!file) { return false; @@ -85,7 +85,7 @@ bool StandardPreferences::Save() bool StandardPreferences::SavePrefs(const char* name) { -#ifdef UNIX +#if defined(UNIX) && defined(HAIKU) FILE *file = fopen(name, "w"); if (!file) { return false; diff --git a/app/system/task_stdc.cpp b/app/system/task_stdc.cpp index fc33bbe7..ed15e747 100755 --- a/app/system/task_stdc.cpp +++ b/app/system/task_stdc.cpp @@ -28,7 +28,7 @@ #include "system/task_stdc.h" #include "system/base/thread.h" -#ifdef UNIX +#if defined(UNIX) || defined(HAIKU) #include #include #include