Expand description
§Get Dir
An utility to get directory.
This utility searches for a target directory by checking for any directories or files that match the provided input.
§Usage
Get directory by target with the following code:
use get_dir::{
Target,
TargetType,
get_dir_by_target,
};
get_dir_by_target(Target {
name: "src",
ty: TargetType::Dir,
});Or get directory by target in reverse with the following code:
use get_dir::{
Target,
TargetType,
get_dir_by_target_reverse,
};
get_dir_by_target_reverse(Target {
name: "LICENSE",
ty: TargetType::File,
});Structs§
- Target
- Target struct for searching functions.
Enums§
- Target
Type - Enum to determine whether the target is a directory or a file.
Functions§
- get_
dir_ by_ target - Search for the first directory containing the specified target from the current directory downwards.
- get_
dir_ by_ target_ reverse - Search for the first directory containing the specified target from the current directory upwards.
- get_
dir_ by_ targets - Search for the first directory containing any of the specified targets from the current directory downwards.
- get_
dir_ by_ targets_ reverse - Search for the first directory containing any of the specified targets from the current directory upwards.
- get_
project_ root - Get the project root directory by searching for
the
targetfolder and theCargo.lockfile. Useget_project_root_directoryto handle the error manually. - get_
project_ root_ directory - Get the project root directory by searching for
the
targetfolder and theCargo.lockfile. Useget_project_rootto handle the error automatically.