Skip to content

Commit

Permalink
Add a libexec/ directory and use it to find the kak command
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mawww committed Dec 8, 2020
1 parent ce97c0d commit 74c337d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions libexec/kak
3 changes: 3 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -162,6 +163,7 @@ distclean: clean

installdirs:
install -d $(bindir) \
$(libexecdir) \
$(sharedir)/rc \
$(sharedir)/colors \
$(sharedir)/doc \
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/shell_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 74c337d

Please sign in to comment.