Expand description
The folders a process searches for the tools machine setup and a run start, worked out as a
value its caller puts on its own PATH: the crate never sets a variable.
An app opened from macOS’s Finder (and from some Linux desktops) starts with a minimal PATH
(/usr/bin:/bin:/usr/sbin:/sbin), not the user’s shell’s, so the folders the tools are
installed in (Homebrew’s, Docker’s, Vagrant’s, the tools inside app bundles: Docker’s CLI,
utmctl, Fusion’s OVF Tool) are appended (augmented). The entries already there keep
priority. The folders of tools the caller places itself (a managed OVF Tool) come last, and
before they exist: a tool placed while the process runs is then found without a restart.
On Windows the PATH is complete at start, but goes stale: an installer (winget, Docker
Desktop, VirtualBox) writes the new one to the registry, which a running process never reads
again. refreshed reads it back (reg query, machine then user, its %VAR%s expanded
with the caller’s variables) and merges it in, with the tool folders that exist now.
Structs§
- Env
- What the tool path is worked out from: the process’s
PATH, the user’s home folder and the variables it reads (Program Files, the system drive, VirtualBox’s install folder, and any a registryPATHnames), as values, so a test hands its own.
Functions§
- appended
currentwith each ofdirsappended that it doesn’t hold yet (an empty one never); None when nothing was added. The entries already there keep their order, so they keep priority.- augmented
- The
PATHan app opened from Finder (or a desktop’s launcher) needs:env’s, then eachtool_dirsfolder that exists, eachfuture_dirsone, thenown, the folders of the tools the caller places itself (which may not exist yet): a hypervisor’s own copy of a tool comes before the caller’s. None when nothing is added. The caller joins it (std::env::join_paths) and sets it. - future_
dirs - The folders added even before they exist, so a tool installed there while the process runs
is found without a restart: on Linux the per-user Google Cloud SDK earlier installs made, on
Windows Vagrant’s folder under the system drive (where its installer puts it), on macOS
/usr/local/binand Homebrew’s: a Mac with Apple silicon has no/usr/local/binuntil an installer makes it for its link (Vagrant’s, the AWS CLI’s), nor Homebrew’s folder until Homebrew is installed. - refreshed
- On Windows,
env’sPATHwith the one installers have since written to the registry (machine, then user, expanded) and the tool folders that exist now merged in: each folder that exists and isn’t there yet, appended. None when nothing is added, and on every other OS (no installer there changes a running process’sPATH). Tworeg queryruns: cheap enough before each machine check. A registry valueregcan’t read is left out. - refreshed_
value refreshedas aPATHvalue a Windows program is started with (;between its folders, whatever this crate was built for): what a step runs with (crate::install::run_step), so it finds a tool installed since this process started. None when nothing is added, and on every other OS.- tool_
dirs - The folders the tools are installed in on
os, whether they exist or not (augmentedadds those that do).