Runbox.Utils.Path (runbox v26.0.0)

View Source

Utilities for handling configured paths.

Summary

Functions

Gets the Altworx root dir.

Resolves a possibly relative path to absolute path by prepending the Altworx root dir (see set_altworx_root/1).

Sets where the Altworx root dir is. Configuration and data dirs are supposed to be relative to the root dir. It is typically the directory which the VM is started in.

Functions

altworx_root_env_var()

get_altworx_root()

@spec get_altworx_root() :: String.t() | nil

Gets the Altworx root dir.

resolve_path(path)

Resolves a possibly relative path to absolute path by prepending the Altworx root dir (see set_altworx_root/1).

Examples

iex> Path.set_altworx_root("/opt/altworx")
:ok
iex> Path.resolve_path("/already/absolute/path")
"/already/absolute/path"
iex> Path.resolve_path("some/../relative/path")
"/opt/altworx/relative/path"

set_altworx_root(path)

@spec set_altworx_root(String.t()) :: :ok

Sets where the Altworx root dir is. Configuration and data dirs are supposed to be relative to the root dir. It is typically the directory which the VM is started in.