diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2011-12-28 22:57:48 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2011-12-28 22:57:48 +0000 |
| commit | e59bdd931e6fa3d4e0c9b7a5d97ca559f894a391 (patch) | |
| tree | 47b0315859d42d5d70d62764782cd4e7a1a178ee /src | |
| parent | ee7bc9ddc0c24939284074ff3cf7e4d41399a305 (diff) | |
search for kakrc next to the kak executable instead of in the current directory
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.cc b/src/main.cc index 11a317d2..1501b78c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -886,7 +886,15 @@ int main(int argc, char* argv[]) try { - exec_commands_in_file({ "kakrc" }, main_context); + const char* kakrc = "kakrc"; + char buffer[2048]; + readlink("/proc/self/exe", buffer, 2048 - strlen(kakrc)); + char* ptr = strrchr(buffer, '/'); + if (ptr) + { + strcpy(ptr+1, kakrc); + exec_commands_in_file({ buffer }, main_context); + } } catch (Kakoune::runtime_error& error) { |
