Skip to content

Commit d600601

Browse files
committed
Add each_parent to WindowsPath
1 parent 8f5cb92 commit d600601

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libstd/path.rs

+8
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,14 @@ impl WindowsPath {
508508
}
509509
}
510510
}
511+
512+
/// Execute a function on p as well as all of its ancestors
513+
pub fn each_parent(&self, f: &fn(&Path)) {
514+
if !self.components.is_empty() {
515+
f(self);
516+
self.pop().each_parent(f);
517+
}
518+
}
511519
}
512520

513521
impl ToStr for PosixPath {

0 commit comments

Comments
 (0)