summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-12-09 09:13:45 +1100
committerMaxime Coste <mawww@kakoune.org>2020-12-09 09:13:45 +1100
commit74c337df5db5dedbd8d8404e27164c3ad6f3e5ef (patch)
tree671f543495cb04c14ec46d84f435963fc9485d9e
parentce97c0dd17238280b5acc15c53599b04265c1921 (diff)
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.
l---------libexec/kak1
-rw-r--r--src/Makefile3
-rw-r--r--src/shell_manager.cc2
3 files changed, 5 insertions, 1 deletions
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<EnvVarDesc> 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);
}
}