safer_remove_dir

Function safer_remove_dir 

Source
pub fn safer_remove_dir<'a>(
    dir_path: &SPath,
    options: impl Into<SaferRemoveOptions<'a>>,
) -> Result<bool>
Expand description

Safely deletes a directory if it passes safety checks.

Safety checks (based on options):

  • If restrict_to_current_dir is true, the directory path must be below the current directory
  • If must_contain_any is set, the path must contain at least one of the specified patterns
  • If must_contain_all is set, the path must contain all of the specified patterns

Returns Ok(true) if the directory was deleted, Ok(false) if it didn’t exist. Returns an error if safety checks fail or deletion fails.