char *__PHYSFS_platformCalcBaseDir(const char *argv0) { /* in case there isn't a BApplication yet, we'll construct a roster. */ BRoster roster; app_info info; status_t rc = roster.GetRunningAppInfo(getTeamID(), &info); BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL); BEntry entry(&(info.ref), true); BPath path; rc = entry.GetPath(&path); /* (path) now has binary's path. */ assert(rc == B_OK); rc = path.GetParent(&path); /* chop filename, keep directory. */ assert(rc == B_OK); const char *str = path.Path(); assert(str != NULL); char *retval = (char *) allocator.Malloc(strlen(str) + 1); BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); strcpy(retval, str); return(retval); } /* __PHYSFS_platformCalcBaseDir */
//------------------------------------------------------------------------------ std::string TInstantiateObjectTester::GetLocalSignature() { BRoster Roster; app_info ai; team_id team; // Get the team_id of this app thread_id tid = find_thread(NULL); thread_info ti; status_t err = get_thread_info(tid, &ti); if (err) { FORMAT_AND_THROW(" failed to get thread_info: ", err); } // Get the app_info via the team_id team = ti.team; team_info info; err = get_team_info(team, &info); if (err) { FORMAT_AND_THROW(" failed to get team_info: ", err); } team = info.team; // It seems that this call to GetRunningAppInfo() is not working because we // don't have an instance of BApplication somewhere -- the roster, therefore, // doesn't know about us. err = Roster.GetRunningAppInfo(team, &ai); if (err) { FORMAT_AND_THROW(" failed to get app_info: ", err); } // Return the signature from the app_info return ai.signature; }