From: Matheus Garcia <37114863+Krush206@users.noreply.github.com> Date: Sat, 21 Oct 2023 15:56:56 +0000 (+0000) Subject: Compatibility with FreeBSD X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=740c6f25f8240deeb732a0a999f2a57cc2f6f6d6;p=libpicofe.git Compatibility with FreeBSD --- diff --git a/linux/in_evdev.c b/linux/in_evdev.c index e046fa6..aca15ad 100644 --- a/linux/in_evdev.c +++ b/linux/in_evdev.c @@ -17,7 +17,11 @@ #include #include #include +#ifdef __FreeBSD__ +#include +#else #include +#endif #include #include "../input.h" diff --git a/linux/plat.c b/linux/plat.c index b1c3314..2cdcace 100644 --- a/linux/plat.c +++ b/linux/plat.c @@ -56,7 +56,13 @@ static int plat_get_exe_dir(char *dst, int len) memcpy(dst, PICO_DATA_DIR, sizeof PICO_DATA_DIR); return sizeof(PICO_DATA_DIR) - 1; #else - int j, ret = readlink("/proc/self/exe", dst, len - 1); + int j, ret = readlink( +#ifdef __FreeBSD__ + "/proc/curproc/file", +#else + "/proc/self/exe", +#endif + dst, len - 1); if (ret < 0) { perror("readlink"); ret = 0; diff --git a/posix.h b/posix.h index 44b6984..6ab9a7f 100644 --- a/posix.h +++ b/posix.h @@ -2,7 +2,7 @@ #define LIBPICOFE_POSIX_H /* define POSIX stuff: dirent, scandir, getcwd, mkdir */ -#if defined(__MACH__) || defined(__linux__) || defined(__MINGW32__) +#if defined(__FreeBSD__) || defined(__MACH__) || defined(__linux__) || defined(__MINGW32__) #include #include