1//------------------------------------------------------------------------------
2//	Copyright (c) 2001-2002, OpenBeOS
3//
4//	Permission is hereby granted, free of charge, to any person obtaining a
5//	copy of this software and associated documentation files (the "Software"),
6//	to deal in the Software without restriction, including without limitation
7//	the rights to use, copy, modify, merge, publish, distribute, sublicense,
8//	and/or sell copies of the Software, and to permit persons to whom the
9//	Software is furnished to do so, subject to the following conditions:
10//
11//	The above copyright notice and this permission notice shall be included in
12//	all copies or substantial portions of the Software.
13//
14//	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15//	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16//	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17//	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18//	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19//	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20//	DEALINGS IN THE SOFTWARE.
21//
22//	File Name:		AppMisc.cpp
23//	Author:			Ingo Weinhold (bonefish@users.sf.net)
24//	Description:	Miscellaneous private functionality.
25//------------------------------------------------------------------------------
26
27#include <string.h>
28#include <sys/utsname.h>
29
30#include <AppMisc.h>
31#include <Entry.h>
32#include <image.h>
33#include <OS.h>
34
35namespace BPrivate {
36
37// get_app_ref
38/*!	\brief Returns an entry_ref referring to the application's executable.
39	\param ref A pointer to a pre-allocated entry_ref to be initialized
40		   to an entry_ref referring to the application's executable.
41	\param traverse If \c true, the function traverses symbolic links.
42	\return
43	- \c B_OK: Everything went fine.
44	- \c B_BAD_VALUE: \c NULL \a ref.
45	- another error code
46*/
47status_t
48get_app_ref(entry_ref *ref, bool traverse)
49{
50//	return get_app_ref(B_CURRENT_TEAM, ref, traverse);
51// TODO: Needed by BResourceStrings. We could implement the function by getting
52// an entry_ref for the argv[0] at initialization time. Now it could be too
53// late (in case the app has changed the cwd).
54return B_ERROR;
55}
56
57// is_running_on_haiku
58/*!	Returns whether we're running under Haiku natively.
59
60	This is a runtime check for components compiled only once for both
61	BeOS and Haiku and nevertheless need to behave differently on the two
62	systems, like the registrar, which uses another MIME database directory
63	under BeOS.
64
65	\return \c true, if we're running under Haiku, \c false otherwise.
66*/
67bool
68is_running_on_haiku()
69{
70	struct utsname info;
71	return (uname(&info) == 0 && strcmp(info.sysname, "Haiku") == 0);
72}
73
74// is_app_showing_modal_window
75/*!	\brief Returns whether the application identified by the supplied
76		   \c team_id is currently showing a modal window.
77	\param team the ID of the application in question.
78	\return \c true, if the application is showing a modal window, \c false
79			otherwise.
80*/
81bool
82is_app_showing_modal_window(team_id team)
83{
84	// TODO: Implement!
85	return true;
86}
87
88} // namespace BPrivate
89
90