Function brane_cli::utils::ensure_package_dir

source ·
pub fn ensure_package_dir(
    name: &str,
    version: Option<&Version>,
    create: bool,
) -> Result<PathBuf, UtilError>
Expand description

Makes sure that the package directory for the given name/version pair exists, then returns the path to it.
If the given version is omitted, just returns the package directory for this name.
If the given version is latest, tries to find the latest version directory to return that; otherwise, always errors (regardless of ‘create’).

Arguments

  • name: The name of the package we want to get the directory from.
  • version: The version of the package. Is optional to have a package directory without any nested versions.
  • create: If set to true, creates the missing file and directories instead of throwing errors.

Returns
A PathBuf with the directory if successfull, or an UtilError otherwise.