From e048550934d3439d955ed6fd8af19347f6aa8e45 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Thu, 16 Mar 2017 13:12:48 -0400 Subject: [PATCH] core: split PATH on ; on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/core/environ.nit | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/environ.nit b/lib/core/environ.nit index 941bd1c..4ef4c99 100644 --- a/lib/core/environ.nit +++ b/lib/core/environ.nit @@ -46,10 +46,12 @@ redef class String # Search for the program `self` in all directories from `PATH` fun program_is_in_path: Bool do + var sep = if is_windows then ";" else ":" var full_path = "PATH".environ - var paths = full_path.split(":") + var paths = full_path.split(sep) for path in paths do if path.file_exists then if path.join_path(self).file_exists then return true + if is_windows and (path / self + ".exe").file_exists then return true end return false -- 1.7.9.5