summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/SDL2/src/filesystem
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-11-16 16:26:13 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2016-11-16 16:28:01 +0100
commit47a05778bff9388fc6c479461dd3804c79d7b539 (patch)
treebb3d4dc8df676b8aa478339b3fd0cd305dc4ac4d /3rdparty/SDL2/src/filesystem
parente61b392edfbfe5b9d70908c087632da915a3abd8 (diff)
Updated SDL2 to 2.0.5 (nw)
Diffstat (limited to '3rdparty/SDL2/src/filesystem')
-rw-r--r--3rdparty/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c4
-rw-r--r--3rdparty/SDL2/src/filesystem/unix/SDL_sysfilesystem.c23
2 files changed, 23 insertions, 4 deletions
diff --git a/3rdparty/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c b/3rdparty/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c
index 45273f24ac0..2570f4c75cf 100644
--- a/3rdparty/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c
+++ b/3rdparty/SDL2/src/filesystem/dummy/SDL_sysfilesystem.c
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
-#ifdef SDL_FILESYSTEM_DUMMY
+#if defined(SDL_FILESYSTEM_DUMMY) || defined(SDL_FILESYSTEM_DISABLED)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent filesystem routines */
@@ -42,6 +42,6 @@ SDL_GetPrefPath(const char *org, const char *app)
return NULL;
}
-#endif /* SDL_FILESYSTEM_DUMMY */
+#endif /* SDL_FILESYSTEM_DUMMY || SDL_FILESYSTEM_DISABLED */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/3rdparty/SDL2/src/filesystem/unix/SDL_sysfilesystem.c b/3rdparty/SDL2/src/filesystem/unix/SDL_sysfilesystem.c
index fa034a45655..bd2e84cd1c5 100644
--- a/3rdparty/SDL2/src/filesystem/unix/SDL_sysfilesystem.c
+++ b/3rdparty/SDL2/src/filesystem/unix/SDL_sysfilesystem.c
@@ -33,7 +33,7 @@
#include <sys/types.h>
#include <limits.h>
-#ifdef __FREEBSD__
+#if defined(__FREEBSD__) || defined(__OPENBSD__)
#include <sys/sysctl.h>
#endif
@@ -90,7 +90,26 @@ SDL_GetBasePath(void)
return NULL;
}
}
-#elif defined(__SOLARIS__)
+#endif
+#if defined(__OPENBSD__)
+ char **retvalargs;
+ size_t len;
+ const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
+ if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) {
+ retvalargs = SDL_malloc(len);
+ if (!retvalargs) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ sysctl(mib, 4, retvalargs, &len, NULL, 0);
+ retval = SDL_malloc(PATH_MAX + 1);
+ if (retval)
+ realpath(retvalargs[0], retval);
+
+ SDL_free(retvalargs);
+ }
+#endif
+#if defined(__SOLARIS__)
const char *path = getexecname();
if ((path != NULL) && (path[0] == '/')) { /* must be absolute path... */
retval = SDL_strdup(path);