From 348eb8074fe0d314ca08fa39f4584019621e3f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 20 Apr 2016 21:31:56 +0200 Subject: vis-lua: load files from directory specified with ./configure --sharedir=DIR Close #231 --- Makefile | 5 +++-- vis-lua.c | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4b166d5..2bfc92c 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,8 @@ SRC = array.c buffer.c libutf.c main.c map.c register.c ring-buffer.c \ # conditionally initialized, this is needed for standalone build # with empty config.mk PREFIX ?= /usr/local -MANPREFIX ?= ${PREFIX}/share/man -SHAREPREFIX ?= ${PREFIX}/share/vis +SHAREPREFIX ?= ${PREFIX}/share +MANPREFIX ?= ${PREFIX}/man VERSION = $(shell git describe 2>/dev/null || echo "0.2") @@ -24,6 +24,7 @@ CFLAGS_VIS = $(CFLAGS_AUTO) $(CFLAGS_TERMKEY) $(CFLAGS_CURSES) $(CFLAGS_ACL) \ $(CFLAGS_SELINUX) $(CFLAGS_LUA) $(CFLAGS_STD) CFLAGS_VIS += -DVERSION=\"${VERSION}\" +CFLAGS_VIS += -DVIS_PATH=\"${SHAREPREFIX}/vis\" CFLAGS_VIS += -DCONFIG_LUA=${CONFIG_LUA} CFLAGS_VIS += -DCONFIG_SELINUX=${CONFIG_SELINUX} CFLAGS_VIS += -DCONFIG_ACL=${CONFIG_ACL} diff --git a/vis-lua.c b/vis-lua.c index fb560ab..6a47a7c 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -11,6 +11,10 @@ #include "vis-core.h" #include "text-motions.h" +#ifndef VIS_PATH +#define VIS_PATH "/usr/local/share/vis" +#endif + #if !CONFIG_LUA void vis_lua_init(Vis *vis) { } @@ -985,14 +989,12 @@ void vis_lua_init(Vis *vis) { * - $VIS_PATH/{,lexers} * - {,lexers} relative to the binary location * - $XDG_CONFIG_HOME/vis/{,lexers} (defaulting to $HOME/.config/vis/{,lexers}) - * - /usr/local/share/vis/{,lexers} - * - /usr/share/vis/{,lexers} + * - /usr/local/share/vis/{,lexers} (or whatever is specified during ./configure) * - package.path (standard lua search path) */ char path[PATH_MAX]; - vis_lua_path_add(vis, "/usr/share/vis"); - vis_lua_path_add(vis, "/usr/local/share/vis"); + vis_lua_path_add(vis, VIS_PATH); /* try to get users home directory */ const char *home = getenv("HOME"); -- cgit v1.2.3