- # set environement value for this symbol
- meth environ=(v: String) do to_s.to_cstring.set_environ(v.to_cstring, 1)
-
- # set default environement value for this symbol
- meth environ_default=(v: String) do to_s.to_cstring.set_environ(v.to_cstring, 0)
-
- # Unset the environement value of this symbol
- meth unset do to_s.to_cstring.unset_environ
+ # Set the enviroment value of a variable.
+ #
+ # "NITis".setenv("fun")
+ # assert "NITis".environ == "fun"
+ fun setenv(v: String) do to_cstring.setenv( v.to_cstring )
+
+ # Search for the program `self` in all directories from `PATH`
+ fun program_is_in_path: Bool
+ do
+ var full_path = "PATH".environ
+ var paths = full_path.split(":")
+ for path in paths do if path.file_exists then
+ if path.join_path(self).file_exists then return true
+ end
+
+ return false
+ end