diff options
| author | bors <bors@rust-lang.org> | 2013-06-28 02:58:34 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-06-28 02:58:34 -0700 |
| commit | 887ae82382ff4fad401a6539356245d2a05d6b4f (patch) | |
| tree | da97dad52b5013bdee686929eace2c64cabec427 /src/libstd | |
| parent | 8600c1881247b2bc30cac6d51aad81a24c0d690e (diff) | |
| parent | ea62fd1090fda26e1e4b68bdc7ef2e11864d80b6 (diff) | |
| download | rust-887ae82382ff4fad401a6539356245d2a05d6b4f.tar.gz rust-887ae82382ff4fad401a6539356245d2a05d6b4f.zip | |
auto merge of #7397 : catamorphism/rust/rustpkg_path, r=catamorphism
r? @brson Unfortunately, the main test for this is ignored due to #7071. Closes #5682
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")] |
