summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cc10
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)
{