SDL_GetBasePath simplification for Haiku.
when solely looking for the path for the current binary in the current team, find_path is sufficient.main
parent
67e2558310
commit
3990c71726
|
@ -28,22 +28,20 @@
|
||||||
#include <kernel/image.h>
|
#include <kernel/image.h>
|
||||||
#include <storage/Directory.h>
|
#include <storage/Directory.h>
|
||||||
#include <storage/Entry.h>
|
#include <storage/Entry.h>
|
||||||
|
#include <storage/FindDirectory.h>
|
||||||
#include <storage/Path.h>
|
#include <storage/Path.h>
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
SDL_GetBasePath(void)
|
SDL_GetBasePath(void)
|
||||||
{
|
{
|
||||||
image_info info;
|
char name[MAXPATHLEN];
|
||||||
int32 cookie = 0;
|
|
||||||
|
|
||||||
while (get_next_image_info(0, &cookie, &info) == B_OK) {
|
if (find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_IMAGE_PATH, NULL, name, sizeof(name)) != B_OK) {
|
||||||
if (info.type == B_APP_IMAGE) {
|
return NULL;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BEntry entry(info.name, true);
|
BEntry entry(name, true);
|
||||||
BPath path;
|
BPath path;
|
||||||
status_t rc = entry.GetPath(&path); /* (path) now has binary's path. */
|
status_t rc = entry.GetPath(&path); /* (path) now has binary's path. */
|
||||||
SDL_assert(rc == B_OK);
|
SDL_assert(rc == B_OK);
|
||||||
|
|
Loading…
Reference in New Issue