1 //------------------------------------------------------------------------------
2 // Copyright (c) 2001-2002, OpenBeOS
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:
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
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.
22 // File Name: AppMisc.cpp
23 // Author: Ingo Weinhold (bonefish@users.sf.net)
24 // Description: Miscellaneous private functionality.
25 //------------------------------------------------------------------------------
28 #include <sys/utsname.h>
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.
43 - \c B_OK: Everything went fine.
44 - \c B_BAD_VALUE: \c NULL \a ref.
48 get_app_ref(entry_ref
*ref
, bool traverse
)
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).
57 // is_running_on_haiku
58 /*! Returns whether we're running under Haiku natively.
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
65 \return \c true, if we're running under Haiku, \c false otherwise.
71 return (uname(&info
) == 0 && strcmp(info
.sysname
, "Haiku") == 0);
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
82 is_app_showing_modal_window(team_id team
)
88 } // namespace BPrivate