pub fn safer_remove_file<'a>(
file_path: &SPath,
options: impl Into<SaferRemoveOptions<'a>>,
) -> Result<bool>Expand description
Safely deletes a file if it passes safety checks.
Safety checks (based on options):
- If
restrict_to_current_diris true, the file path must be below the current directory - If
must_contain_anyis set, the path must contain at least one of the specified patterns - If
must_contain_allis set, the path must contain all of the specified patterns
Returns Ok(true) if the file was deleted, Ok(false) if it didn’t exist. Returns an error if safety checks fail or deletion fails.