fix QS not opening from tracker

This commit is contained in:
Jaycie Ewald 2023-05-23 14:36:33 -05:00
parent c1e8a1e692
commit 70df2b661e
1 changed files with 17 additions and 1 deletions

View File

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#ifdef PLATFORM_OSX
#if defined(PLATFORM_OSX) || defined(PLATFORM_HAIKU)
#include <libgen.h> /* dirname() and basename() */
#endif
#include <sys/stat.h>
@ -321,6 +321,21 @@ static void Sys_GetBasedir (char *argv0, char *dst, size_t dstsize)
{
char *tmp;
#ifdef PLATFORM_HAIKU
if (realpath(argv0, dst) == NULL)
{
perror("realpath");
if (getcwd(dst, dstsize - 1) == NULL)
_fail: Sys_Error ("Couldn't determine current directory");
}
else
{
/* strip off the binary name */
if (! (tmp = strdup (dst))) goto _fail;
q_strlcpy (dst, dirname(tmp), dstsize);
free (tmp);
}
#else
if (getcwd(dst, dstsize - 1) == NULL)
Sys_Error ("Couldn't determine current directory");
@ -333,6 +348,7 @@ static void Sys_GetBasedir (char *argv0, char *dst, size_t dstsize)
if (tmp != dst && *tmp == '/')
*tmp = 0;
}
#endif
}
#endif