Returns the absolute path where an environment is expected under the data directory of its backend. It returns the path even if the environment does not exist yet.
Arguments
- env_name
Character string with the environment name. It must be a plain directory name that is valid on Linux, macOS and Windows:
Not empty, and not
.or...Not starting with
-, and not ending with..Without path separators,
:,#, whitespace, control characters or<>"|?*.Not a Windows device name, such as
NULorCOM1(see Environment names increate_env()).
Invalid values abort with class
condathis_invalid_env_name.run(),run_bin(),run_pipeline()andrun_step()also accept anenv_path()value. The other functions reject it with classcondathis_env_path_read_only.- method
Character string naming the backend.
"auto"(the default) uses the backend that ownsenv_namewhen it exists, and otherwise the first available backend ingetOption("condathis.backend_priority")order (see condathis-options). Any name fromlist_registered_backend_names()selects that backend, and"micromamba"is built in. The name of a backend whose packagecondathisknows, such as"rattler"of therattlerthispackage, also selects it.condathisloads the package on first use."native"is a deprecated alias for"micromamba"(warns once per session). The 0.1.4 defaultc("native", "auto")is read as"native".If you name a backend other than the owner, functions that change the environment abort. The others warn and use the owner. The classes:
condathis_backend_not_installed: the package of the named backend is not installed.condathis_backend_mismatch: the named backend does not own the environment, and the function changes it.condathis_backend_mismatch_warning(a warning): the same, for a function that does not change the environment.condathis_backend_ambiguous_env: several backends have an environment of that name, andmethodnames none of them.condathis_invalid_method: an invalid value.
Details
Looks up which registered backend owns env_name, and creates the
backend's data directory when needed. It creates no environment. When
env_name has no directory yet, it does not start or install
micromamba.
See also
Other environments:
create_env(),
env_definition(),
env_exists(),
env_path(),
install_packages(),
list_envs(),
list_packages(),
remove_env(),
validate_env()
Examples
condathis::with_sandbox_dir({
# Get the default environment directory
print(condathis::get_env_dir())
#> <data dir>/R/condathis/envs/condathis-env
# Get the directory for a specific environment
condathis::get_env_dir("my-env")
#> <data dir>/R/condathis/envs/my-env
})
#> /tmp/Rtmpel16Et/condathis-sandbox-29a62d1581a8/data/R/condathis/envs/condathis-env
#> /tmp/Rtmpel16Et/condathis-sandbox-29a62d1581a8/data/R/condathis/envs/my-env