summaryrefslogtreecommitdiffstats
path: root/src/files.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/files.rs')
-rw-r--r--src/files.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/files.rs b/src/files.rs
index c7896fb..f546a00 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -271,7 +271,7 @@ impl File {
}
}
- pub fn new_from_path(path: &Path) -> Result<File, Error> {
+ pub fn new_from_path(path: &Path) -> HResult<File> {
let pathbuf = path.to_path_buf();
let name = path
.file_name()
@@ -353,6 +353,11 @@ impl File {
Some(self.path.parent()?.parent()?.to_path_buf())
}
+ pub fn grand_parent_as_file(&self) -> HResult<File> {
+ let pathbuf = self.grand_parent()?;
+ File::new_from_path(&pathbuf)
+ }
+
pub fn is_dir(&self) -> bool {
self.kind == Kind::Directory
}