diff --git a/headers/private/app/AppMisc.h b/headers/private/app/AppMisc.h index 250c9e31b3..4eb2709671 100644 --- a/headers/private/app/AppMisc.h +++ b/headers/private/app/AppMisc.h @@ -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 diff --git a/src/kits/app/AppMisc.cpp b/src/kits/app/AppMisc.cpp index fb16e2ff8f..b06aaa0495 100644 --- a/src/kits/app/AppMisc.cpp +++ b/src/kits/app/AppMisc.cpp @@ -31,6 +31,8 @@ #include #include +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 + diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index 23b457649d..eed1a0c2d3 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -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) {