From 74c337df5db5dedbd8d8404e27164c3ad6f3e5ef Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 9 Dec 2020 09:13:45 +1100 Subject: [PATCH] Add a libexec/ directory and use it to find the kak command Add that libexec directory to the PATH instead of the current kak binary directory to avoid impacting other commands. The libexec directory currently only contains a symlink back to the Kakoune binary. --- libexec/kak | 1 + src/Makefile | 3 +++ src/shell_manager.cc | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 120000 libexec/kak diff --git a/libexec/kak b/libexec/kak new file mode 120000 index 00000000..a903b0d0 --- /dev/null +++ b/libexec/kak @@ -0,0 +1 @@ +../src/kak \ No newline at end of file diff --git a/src/Makefile b/src/Makefile index e292af60..97d7bc5b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -55,6 +55,7 @@ PREFIX ?= /usr/local DESTDIR ?= # root dir bindir := $(DESTDIR)$(PREFIX)/bin +libexecdir := $(DESTDIR)$(PREFIX)/libexec/kak sharedir := $(DESTDIR)$(PREFIX)/share/kak docdir := $(DESTDIR)$(PREFIX)/share/doc/kak mandir := $(DESTDIR)$(PREFIX)/share/man/man1 @@ -162,6 +163,7 @@ distclean: clean installdirs: install -d $(bindir) \ + $(libexecdir) \ $(sharedir)/rc \ $(sharedir)/colors \ $(sharedir)/doc \ @@ -170,6 +172,7 @@ installdirs: install: kak man installdirs install -m 0755 kak $(bindir) + ln -rsf $(bindir)/kak $(libexecdir)/kak install -m 0644 ../share/kak/kakrc $(sharedir) install -m 0644 ../doc/pages/*.asciidoc $(sharedir)/doc cp -r ../rc/* $(sharedir)/rc diff --git a/src/shell_manager.cc b/src/shell_manager.cc index 8d70dd1c..591a708d 100644 --- a/src/shell_manager.cc +++ b/src/shell_manager.cc @@ -72,7 +72,7 @@ ShellManager::ShellManager(ConstArrayView builtin_env_vars) // have access to the kak command regardless of if the user installed it { const char* path = getenv("PATH"); - auto new_path = format("{}:{}", path, split_path(get_kak_binary_path()).first); + auto new_path = format("{}../libexec/kak:{}", split_path(get_kak_binary_path()).first, path); setenv("PATH", new_path.c_str(), 1); } }