From 6fabd367328bfbdee52900e365c96a571b7ec54f Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 16 Jul 2019 16:19:52 +0200 Subject: [PATCH] freebsd: fix os.executable() --- vlib/os/os.v | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vlib/os/os.v b/vlib/os/os.v index f08ea9e0ad..82a8ac5b7d 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -552,6 +552,14 @@ pub fn executable() string { return string(result) */ } + $if freebsd { + mut mib := [1 /* CTL_KERN */, 14 /* KERN_PROC */, 12 /* KERN_PROC_PATHNAME */, -1]!! + buf := [1024]byte + size := 1024 + C.sysctl(mib, 4, buf, &size, 0, 0) + return string(buf) + } + } pub fn is_dir(path string) bool {