X-Git-Url: http://nitlanguage.org diff --git a/lib/core/environ.nit b/lib/core/environ.nit index 4747a6e..4ef4c99 100644 --- a/lib/core/environ.nit +++ b/lib/core/environ.nit @@ -46,19 +46,21 @@ 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 end end -redef class NativeString - private fun get_environ: NativeString `{ return getenv(self); `} - private fun setenv(value: NativeString) `{ +redef class CString + private fun get_environ: CString `{ return getenv(self); `} + private fun setenv(value: CString) `{ #ifdef _WIN32 _putenv_s(self, value); #else