diff --git a/src/walk/mod.rs b/src/walk/mod.rs index bf401aa..8825381 100644 --- a/src/walk/mod.rs +++ b/src/walk/mod.rs @@ -446,6 +446,19 @@ pub trait Entry { /// The root path is the path to the walked directory from which the file entry has been read. /// The relative path is the remainder of the file path of the entry (the path relative to the /// root directory). The relative path may be empty. + /// + /// The root and relative paths can differ significantly depending on the way a directory is + /// walked, in particular when using a [`Glob`]. The following table describes some example + /// paths when using [`Glob::walk`]. + /// + /// | Glob Expression | Directory | Path | Root | Relative | + /// |---------------------------|--------------|------------------------------------|--------------|----------------------------------| + /// | `**/*.txt` | `/home/user` | `/home/user/notes.txt` | `/home/user` | `notes.txt` | + /// | `projects/**/src/**/*.rs` | `.` | `./projects/fibonacci/src/main.rs` | `.` | `projects/fibonacci/src/main.rs` | + /// | `/var/log/**/*.log` | `.` | `/var/log/pacman.log` | | `/var/log/pacman.log` | + /// + /// [`Glob`]: crate::Glob + /// [`Glob::walk`]: crate::Glob::walk fn root_relative_paths(&self) -> (&Path, &Path); /// Gets the [`Metadata`] of the file. @@ -655,8 +668,6 @@ pub trait FileIterator: /// combinator does not read conventionally hidden directory trees. /// /// ```rust,no_run - /// #[cfg(windows)] - /// use wax::walk::EntryResidue; /// use wax::walk::{Entry, FileIterator}; /// use wax::Glob; /// @@ -670,6 +681,7 @@ pub trait FileIterator: /// #[cfg(windows)] /// let walk = walk.filter_entry(|entry| { /// use std::os::windows::fs::MetadataExt as _; + /// use wax::walk::EntryResidue; /// /// const ATTRIBUTE_HIDDEN: u32 = 0x2; ///