platform/beos.cpp
branchstable-2.0
changeset 1132 ff6943f29c3e
parent 947 b0c91495af9b
child 1294 184697ee7a77
equal deleted inserted replaced
1095:69b884a15de1 1132:ff6943f29c3e
   172 } /* getTeamID */
   172 } /* getTeamID */
   173 
   173 
   174 
   174 
   175 char *__PHYSFS_platformCalcBaseDir(const char *argv0)
   175 char *__PHYSFS_platformCalcBaseDir(const char *argv0)
   176 {
   176 {
   177     /* in case there isn't a BApplication yet, we'll construct a roster. */
   177     image_info info;
   178     BRoster roster; 
   178     int32 cookie = 0;
   179     app_info info;
   179 
   180     status_t rc = roster.GetRunningAppInfo(getTeamID(), &info);
   180     while (get_next_image_info(0, &cookie, &info) == B_OK) {
   181     BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL);
   181         if (info.type == B_APP_IMAGE)
   182     BEntry entry(&(info.ref), true);
   182             break;
       
   183     }
       
   184 
       
   185     BEntry entry(info.name, true);
   183     BPath path;
   186     BPath path;
   184     rc = entry.GetPath(&path);  /* (path) now has binary's path. */
   187     status_t rc = entry.GetPath(&path);  /* (path) now has binary's path. */
   185     assert(rc == B_OK);
   188     assert(rc == B_OK);
   186     rc = path.GetParent(&path); /* chop filename, keep directory. */
   189     rc = path.GetParent(&path); /* chop filename, keep directory. */
   187     assert(rc == B_OK);
   190     assert(rc == B_OK);
   188     const char *str = path.Path();
   191     const char *str = path.Path();
   189     assert(str != NULL);
   192     assert(str != NULL);