[aseprite] 70/308: Support for FreeBSD get_app_path

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:44:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 382881ad669443b9fc072e87f592cfefee5d041b
Author: Tony Narlock <tony at git-pull.com>
Date:   Tue Dec 8 02:30:21 2015 -0600

    Support for FreeBSD get_app_path
    
    Fixes #889
    
    Add support with and without procfs.
    
    See also: https://www.libsdl.org/tmp/SDL/src/filesystem/unix/SDL_sysfilesystem.c
---
 src/base/fs_unix.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/base/fs_unix.h b/src/base/fs_unix.h
index 6c1f51e..77e4e79 100644
--- a/src/base/fs_unix.h
+++ b/src/base/fs_unix.h
@@ -16,6 +16,8 @@
 
 #if __APPLE__
 #include <mach-o/dyld.h>
+#elif __FreeBSD__
+#include <sys/sysctl.h>
 #endif
 
 #include "base/path.h"
@@ -120,15 +122,16 @@ std::string get_app_path()
   std::vector<char> path(MAXPATHLEN);
 
 #if __APPLE__
-
   uint32_t size = path.size();
   while (_NSGetExecutablePath(&path[0], &size) == -1)
     path.resize(size);
-
-#else
-
+#elif __FreeBSD__
+  size_t size = path.size();
+  const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+  while (sysctl(mib, 4, &path[0], &size, NULL, 0) == -1)
+      path.resize(size);
+#else  /* linux */
   readlink("/proc/self/exe", &path[0], path.size());
-
 #endif
 
   return std::string(&path[0]);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list