Function brane_cli::utils::get_package_dir
source ยท pub fn get_package_dir(
name: &str,
version: Option<&Version>,
) -> Result<PathBuf, UtilError>
Expand description
Edited: Now returning UtilErrors.
Gets the directory where we likely stored the package.
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, errors that there are no versions to choose from.
Does not guarantee that the directory also exists; check ensure_package_dir() for that.
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 that ignores versions.
Returns
A PathBuf with the directory if successfull, or an UtilError otherwise.