From 6c2e3131550a8476ac3933e34c7acfdb569f259b Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Mon, 15 Jul 2019 00:50:24 +1000 Subject: [PATCH] add missing implementation of os.getexepath for mac --- vlib/os/os.v | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vlib/os/os.v b/vlib/os/os.v index 0300f33dc3..76dd0acd05 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -520,8 +520,11 @@ pub fn getexepath() string { } $if mac { - //panic('getexepath() not impl') - return '' + mut bufsize := MAX_PATH // if buffer is too small this will be updated with size needed + if C._NSGetExecutablePath(result, &bufsize) == -1 { + panic('Could not get executable path, buffer too small (need: $bufsize).') + } + return tos(result, strlen(result)) } }