SDL: SDL_GetBasePath simplification for Haiku.

From 3990c71726f01795c58901b2a4479bb00a23a64d Mon Sep 17 00:00:00 2001
From: David Carlier <[EMAIL REDACTED]>
Date: Sun, 12 Mar 2023 11:55:42 +0000
Subject: [PATCH] SDL_GetBasePath simplification for Haiku. when solely looking
 for the path for the current binary in the current team, find_path is
 sufficient.

---
 src/filesystem/haiku/SDL_sysfilesystem.cc | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/filesystem/haiku/SDL_sysfilesystem.cc b/src/filesystem/haiku/SDL_sysfilesystem.cc
index 8e61a79dab40..c8378e7b93d4 100644
--- a/src/filesystem/haiku/SDL_sysfilesystem.cc
+++ b/src/filesystem/haiku/SDL_sysfilesystem.cc
@@ -28,22 +28,20 @@
 #include <kernel/image.h>
 #include <storage/Directory.h>
 #include <storage/Entry.h>
+#include <storage/FindDirectory.h>
 #include <storage/Path.h>
 
 
 char *
 SDL_GetBasePath(void)
 {
-    image_info info;
-    int32 cookie = 0;
+    char name[MAXPATHLEN];
 
-    while (get_next_image_info(0, &cookie, &info) == B_OK) {
-        if (info.type == B_APP_IMAGE) {
-            break;
-        }
+    if (find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_IMAGE_PATH, NULL, name, sizeof(name)) != B_OK) {
+        return NULL;
     }
 
-    BEntry entry(info.name, true);
+    BEntry entry(name, true);
     BPath path;
     status_t rc = entry.GetPath(&path);  /* (path) now has binary's path. */
     SDL_assert(rc == B_OK);