diff --git a/compiler/cgen.v b/compiler/cgen.v index 12206e51af..e37c17ae20 100644 --- a/compiler/cgen.v +++ b/compiler/cgen.v @@ -277,6 +277,7 @@ fn os_name_to_ifdef(name string) string { case 'msvc': return '_MSC_VER' case 'android': return '__BIONIC__' case 'js': return '_VJS' + case 'solaris': return '__sun' } verror('bad os ifdef name "$name"') return '' @@ -289,6 +290,7 @@ fn platform_postfix_to_ifdefguard(name string) string { case '_nix.v': return '#ifndef _WIN32' case '_lin.v': return '#ifdef __linux__' case '_mac.v': return '#ifdef __APPLE__' + case '_solaris.v': return '#ifdef __sun' } verror('bad platform_postfix "$name"') return '' diff --git a/compiler/main.v b/compiler/main.v index 4b0171efba..9e0aa492b3 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -28,7 +28,7 @@ enum BuildMode { const ( SupportedPlatforms = ['windows', 'mac', 'linux', 'freebsd', 'openbsd', - 'netbsd', 'dragonfly', 'msvc', 'android', 'js'] + 'netbsd', 'dragonfly', 'msvc', 'android', 'js', 'solaris'] ModPath = os.home_dir() + '/.vmodules/' ) diff --git a/vlib/os/os.v b/vlib/os/os.v index 05e19be6cb..4d2332e444 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -631,6 +631,8 @@ pub fn executable() string { // lol return os.args[0] } + $if solaris { + } $if netbsd { mut result := malloc(MAX_PATH) count := int(C.readlink('/proc/curproc/exe', result, MAX_PATH )) @@ -647,7 +649,7 @@ pub fn executable() string { } return string(result, count) } - return '.' + return os.args[0] } pub fn is_dir(path string) bool {