Add each_parent to WindowsPath

This commit is contained in:
Corey Richardson 2013-06-28 08:51:31 -04:00
parent 8f5cb92f89
commit d600601162

View File

@ -508,6 +508,14 @@ impl WindowsPath {
} }
} }
} }
/// 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);
}
}
} }
impl ToStr for PosixPath { impl ToStr for PosixPath {