diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/path.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 700bfff3f5d..89792694011 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -382,6 +382,15 @@ impl Path { Some(ref st) => Some(st.st_mode as uint), } } + + /// Execute a function on p as well as all of its ancestors + pub fn each_parent(&self, f: &fn(&Path)) { + if !self.components.is_empty() { + f(self); + self.pop().each_parent(f); + } + } + } #[cfg(target_os = "freebsd")] |
