From 9171d496e2123f98d252352ecb8b09c166fa5515 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 17 Jan 2005 01:20:22 +0000 Subject: [PATCH] Added function is_running_on_haiku(), which returns at runtime whether we're running under Haiku. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10783 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/app/AppMisc.h | 2 ++ src/kits/app/AppMisc.cpp | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/headers/private/app/AppMisc.h b/headers/private/app/AppMisc.h index 3c91b09cca..f1be8cdeb5 100644 --- a/headers/private/app/AppMisc.h +++ b/headers/private/app/AppMisc.h @@ -41,6 +41,8 @@ status_t get_app_ref(entry_ref *ref, bool traverse = true); team_id current_team(); thread_id main_thread_for(team_id team); +bool is_running_on_haiku(); + } // namespace BPrivate // _get_object_token_ diff --git a/src/kits/app/AppMisc.cpp b/src/kits/app/AppMisc.cpp index 4f3ec80b1e..631cf344e6 100644 --- a/src/kits/app/AppMisc.cpp +++ b/src/kits/app/AppMisc.cpp @@ -25,6 +25,7 @@ //------------------------------------------------------------------------------ #include +#include #include #include @@ -128,5 +129,22 @@ main_thread_for(team_id team) return thread; } +// is_running_on_haiku +/*! Returns whether we're running under Haiku natively. + + This is a runtime check for components compiled only once for both + BeOS and Haiku and nevertheless need to behave differently on the two + systems, like the registrar, which uses another MIME database directory + under BeOS. + + \return \c true, if we're running under Haiku, \c false otherwise. +*/ +bool +is_running_on_haiku() +{ + struct utsname info; + return (uname(&info) == 0 && strcmp(info.sysname, "Haiku") == 0); +} + } // namespace BPrivate