Moved the miscellaneous app kit functions into the BPrivate namespace and added the function current_team() which returns the ID of the current team.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1501 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -32,9 +32,14 @@
|
||||
|
||||
struct entry_ref;
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
status_t get_app_path(char *buffer);
|
||||
status_t get_app_ref(entry_ref *ref, bool traverse = true);
|
||||
|
||||
team_id current_team();
|
||||
thread_id main_thread_for(team_id team);
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif // _APP_MISC_H
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <image.h>
|
||||
#include <OS.h>
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
// get_app_path
|
||||
/*! \brief Returns the path to the application's executable.
|
||||
\param buffer A pointer to a pre-allocated character array of at least
|
||||
@@ -89,6 +91,20 @@ get_app_ref(entry_ref *ref, bool traverse)
|
||||
return error;
|
||||
}
|
||||
|
||||
// current_team
|
||||
/*! \brief Returns the ID of the current team.
|
||||
\return The ID of the current team.
|
||||
*/
|
||||
team_id
|
||||
current_team()
|
||||
{
|
||||
team_id team = -1;
|
||||
thread_info info;
|
||||
if (get_thread_info(find_thread(NULL), &info) == B_OK)
|
||||
team = info.team;
|
||||
return team;
|
||||
}
|
||||
|
||||
// main_thread_for
|
||||
/*! Returns the ID of the supplied team's main thread.
|
||||
\param team The team.
|
||||
@@ -112,3 +128,5 @@ main_thread_for(team_id team)
|
||||
return thread;
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
@@ -613,11 +613,11 @@ void BApplication::InitData(const char* signature, status_t* error)
|
||||
bool isRegistrar = (signature && !strcmp(signature, kRegistrarSignature));
|
||||
// get team and thread
|
||||
team_id team = Team();
|
||||
thread_id thread = main_thread_for(team);
|
||||
thread_id thread = BPrivate::main_thread_for(team);
|
||||
// get app executable ref
|
||||
entry_ref ref;
|
||||
if (fInitError == B_OK)
|
||||
fInitError = get_app_ref(&ref);
|
||||
fInitError = BPrivate::get_app_ref(&ref);
|
||||
// get the BAppFileInfo and extract the information we need
|
||||
uint32 appFlags = B_REG_DEFAULT_APP_FLAGS;
|
||||
if (fInitError == B_OK) {
|
||||
|
||||
Reference in New Issue
Block a user