pub fn ensure_datasets_dir(create: bool) -> Result<PathBuf, UtilError>
Expand description
Makes sure that Brane’s dataset directory exists, and then returns its path.
Basically, tries to resolve the folder ~/.local/share/brane/data
.
§Arguments
create
: If set to true, creates the missing directories instead of throwing errors.
§Returns
A PathBuf with the absolute path to the datasets directory that is also guaranteed to exist.
§Errors
This function errors if we failed to get the Brane data directory (no confusion at all, lol) or the directory did not exist (if create
is false) / was not accessible.