From ea62fd1090fda26e1e4b68bdc7ef2e11864d80b6 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 25 Jun 2013 19:49:01 -0700 Subject: rustpkg: Implement RUST_PATH Unfortunately, the main test for this is ignored due to #7071. Closes #5682 --- src/libstd/path.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libstd') 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")] -- cgit 1.4.1-3-g733a5