From 734da8f61b8531dcbab7d75467bc0f701e0dfaf7 Mon Sep 17 00:00:00 2001 From: vindarel Date: Tue, 3 Sep 2024 14:03:51 +0200 Subject: [PATCH] os: getenv with directories --- os.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/os.md b/os.md index a2d88c6..7fc87b8 100644 --- a/os.md +++ b/os.md @@ -58,6 +58,22 @@ Also note that the library has the method `(environment-variable "name")`, on POSIX-like systems including Windows. It is also `fset`-able. +### Environment variables with directories (PATH) + +A function allows to retrieve the list of directories from an environment variable: + +```lisp +(uiop:getenv-absolute-directories "PATH") +;; => (#P"/home/vince/.local/bin/" #P"/usr/local/bin/" #P"/usr/sbin/" #P"/usr/bin/") +``` + +Its documentation: + +> Extract a list of absolute directories from a user-configured environment variable, as per native OS. Any empty entries in the environment variable X will be returned as NILs. + +Use `uiop:getenv-absolute-directory` when the env var contains one directory. See also: `uiop:getenv-pathname[s]`. + + ## Accessing the command line arguments