From 57dd26650c599acbc3262a0b0bd61d7a6913e8dc Mon Sep 17 00:00:00 2001 From: asvvvad <36175183+asvvvad@users.noreply.github.com> Date: Sat, 16 May 2020 16:10:34 +0100 Subject: [PATCH] os: add new function exists_in_system_path --- vlib/os/os.v | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vlib/os/os.v b/vlib/os/os.v index 008f2cb578..cc203c1b95 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -946,6 +946,14 @@ pub fn find_abs_path_of_executable(exepath string) ?string { return error('failed to find executable') } +// exists_in_system_path returns true if prog exists in the system's path +fn exists_in_system_path(prog string) bool { + os.find_abs_path_of_executable(prog) or { + return false + } + return true +} + [deprecated] pub fn dir_exists(path string) bool { panic('Use `os.is_dir` instead of `os.dir_exists`')