21#include "../../SDL_internal.h"
23#ifdef SDL_FILESYSTEM_UNIX
37#if defined(__FREEBSD__) || defined(__OPENBSD__)
38#include <sys/sysctl.h>
47#if !defined(__QNXNTO__)
49readSymLink(
const char *
path)
68 }
else if (rc <
len) {
86#if defined(__FREEBSD__)
87 char fullpath[PATH_MAX];
88 size_t buflen =
sizeof (fullpath);
89 const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
98#if defined(__OPENBSD__)
101 const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
108 sysctl(mib, 4, retvalargs, &
len,
NULL, 0);
111 realpath(retvalargs[0],
retval);
116#if defined(__SOLARIS__)
117 const char *
path = getexecname();
132#if defined(__FREEBSD__)
133 retval = readSymLink(
"/proc/curproc/file");
134#elif defined(__NETBSD__)
135 retval = readSymLink(
"/proc/curproc/exe");
136#elif defined(__QNXNTO__)
139 retval = readSymLink(
"/proc/self/exe");
145 (
unsigned long long) getpid());
146 if ( (rc > 0) && (rc <
sizeof(
path)) ) {
186 const char *envr =
SDL_getenv(
"XDG_DATA_HOME");
205 SDL_SetError(
"neither XDG_DATA_HOME nor HOME environment is set");
208 append =
"/.local/share/";
214 if (envr[
len - 1] ==
'/')
230 for (ptr =
retval+1; *ptr; ptr++) {
233 if (mkdir(
retval, 0700) != 0 && errno != EEXIST)
238 if (mkdir(
retval, 0700) != 0 && errno != EEXIST) {
#define SDL_OutOfMemory()
#define SDL_InvalidParamError(param)
Include file for filesystem SDL API functions.
char * SDL_GetBasePath(void)
Get the path where the application resides.
GLuint GLint GLboolean GLint GLenum access
GLsizei const GLchar *const * path
#define SDL_arraysize(array)