1 /* 2 * Copyright 2001-2019 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold, bonefish@users.sf.net 7 * Jacob Secunda 8 */ 9 10 #include <string.h> 11 #include <sys/utsname.h> 12 13 #include <AppMisc.h> 14 #include <Entry.h> 15 #include <image.h> 16 #include <OS.h> 17 18 namespace BPrivate { 19 20 // get_app_ref 21 /*! \brief Returns an entry_ref referring to the application's executable. 22 \param ref A pointer to a pre-allocated entry_ref to be initialized 23 to an entry_ref referring to the application's executable. 24 \param traverse If \c true, the function traverses symbolic links. 25 \return 26 - \c B_OK: Everything went fine. 27 - \c B_BAD_VALUE: \c NULL \a ref. 28 - another error code 29 */ 30 status_t 31 get_app_ref(entry_ref *ref, bool traverse) 32 { 33 // return get_app_ref(B_CURRENT_TEAM, ref, traverse); 34 // TODO: Needed by BResourceStrings. We could implement the function by getting 35 // an entry_ref for the argv[0] at initialization time. Now it could be too 36 // late (in case the app has changed the cwd). 37 return B_ERROR; 38 } 39 40 // is_running_on_haiku 41 /*! Returns whether we're running under Haiku natively. 42 43 This is a runtime check for components compiled only once for both 44 BeOS and Haiku and nevertheless need to behave differently on the two 45 systems, like the registrar, which uses another MIME database directory 46 under BeOS. 47 48 \return \c true, if we're running under Haiku, \c false otherwise. 49 */ 50 bool 51 is_running_on_haiku() 52 { 53 struct utsname info; 54 return (uname(&info) == 0 && strcmp(info.sysname, "Haiku") == 0); 55 } 56 57 } // namespace BPrivate 58 59