Fallback on /usr/share/kak if the relative runtime path does not exists
This commit is contained in:
parent
a7d93fa11e
commit
995a094471
|
@ -34,7 +34,13 @@ using namespace Kakoune;
|
||||||
|
|
||||||
String runtime_directory()
|
String runtime_directory()
|
||||||
{
|
{
|
||||||
return split_path(get_kak_binary_path()).first + "../share/kak";
|
char relpath[PATH_MAX+1];
|
||||||
|
format_to(relpath, "{}../share/kak", split_path(get_kak_binary_path()).first);
|
||||||
|
struct stat st;
|
||||||
|
if (stat(relpath, &st) == 0 and S_ISDIR(st.st_mode))
|
||||||
|
return real_path(relpath);
|
||||||
|
|
||||||
|
return "/usr/share/kak";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write(int fd, StringView str)
|
static void write(int fd, StringView str)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user