Expand description
§小道 Komichi
komichi
is a collection of tools to make working with file-system paths
more convenient.
§Features, include but are not limited to:
- Uses
camino
paths so that an application, using this crate, can treat paths like normal Rust string-like types. EnvVal
provides the ability to retrieve environment variable values and use a default value if the environment variable does NOT exist or have a value.Expand
provides a relatively-fast ability to expand unicode-paths that:- may contain BASH-like variables; and
- may start with a tilde; and
- may not be absolute.
Local
can provide application local ($HOME
) path directory locations for:- cache files
- config files
- data files
- log files
- state files
Modules§
Structs§
- EnvVal
- Used to acquire an environment variable value with a fallback value.
- Expand
- Expand identifiers in paths.
- Local
- Return path locations for a given application name from a local perspective.
Functions§
- expand_
cwd - Prepend the current working directory (“CWD”) to the given
path
. - expand_
environment_ identifiers - Expand any environment variables in the given
path
- expand_
strict_ with - Strictly expand the given
path
with the given function/callback. - expand_
tilde - Expand a starting tilde in the given
path
to the home directory. - expand_
with - Expand the given
path
with the given function/callback. - get_cwd
- Return the current user’s current working directory (“CWD”) as a
Utf8PathBuf
. - get_
home - Return the current user’s home directory as a
Utf8PathBuf
. - get_
local_ application_ paths - Return a
Local
struct that has functions to get various local application paths for the given application name. - normalize
- Return the given path with all its intermediate components normalized, without performing I/O.
- scrub
- Replace the user’s home directory, in the given path, with a tilde.
- use_cwd
- Return the given path or the current user’s current working directory
(“CWD”) as a
Utf8PathBuf
. - use_
home - Return the given home directory or the current user’s home directory
as a
Utf8PathBuf
. - utf8_
path_ buf - Convert the given path into a
Utf8PathBuf
.