diff options
| author | Corey Richardson <corey@octayn.net> | 2013-06-28 08:51:31 -0400 |
|---|---|---|
| committer | Corey Richardson <corey@octayn.net> | 2013-06-28 10:47:59 -0400 |
| commit | d600601162d8a28b0a7e4eeaba81d0c2cee2e226 (patch) | |
| tree | 3ab7b302d90805d7b2ca0a57bc8e0c5fe457bdc6 /src/libstd | |
| parent | 8f5cb92f89a48fd47b0eff6fa72aa2f0b18188b3 (diff) | |
| download | rust-d600601162d8a28b0a7e4eeaba81d0c2cee2e226.tar.gz rust-d600601162d8a28b0a7e4eeaba81d0c2cee2e226.zip | |
Add each_parent to WindowsPath
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/path.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 9b4a3270f28..a5e82c31d79 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -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 { |
