Function brane_cli::utils::ensure_instance_dir

source ·
pub fn ensure_instance_dir(
    name: impl AsRef<str>,
    create: bool,
) -> Result<PathBuf, UtilError>
Expand description

Gets the directory where we store the instance definition for the given instance and ensures it exists.

§Arguments

  • name: The name of the instance for which to get the directory.
  • create: If given, ensures it exists by attempting to create it. If set to false, then this function will error if it does not exist instead.

§Returns

The path to the directory where we shall/have store(d) instance definition. You can assume the directory exists if this happens.

§Errors

This function errors if we failed to get the Brane configuration directory or if we failed to create any directory required.