Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion vis-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#include "vis-core.h"
#include "text-motions.h"

#ifdef _DARWIN_C_SOURCE
#include <libproc.h>
#endif

#ifndef VIS_PATH
#define VIS_PATH "/usr/local/share/vis"
#endif
Expand Down Expand Up @@ -3228,7 +3232,12 @@ static void vis_lua_init(Vis *vis) {
vis_lua_path_add(vis, path);
}

ssize_t len = readlink("/proc/self/exe", path, sizeof(path)-1);
ssize_t len;
#ifdef _DARWIN_C_SOURCE
len = proc_pidpath(getpid(), path, sizeof(path));
#else
len = readlink("/proc/self/exe", path, sizeof(path)-1);
#endif
if (len > 0) {
path[len] = '\0';
/* some idiotic dirname(3) implementations return pointers to statically
Expand Down