Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/paths/src/lib.rs')
| -rw-r--r-- | crates/paths/src/lib.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/paths/src/lib.rs b/crates/paths/src/lib.rs index ac09121aed..6a3c685016 100644 --- a/crates/paths/src/lib.rs +++ b/crates/paths/src/lib.rs @@ -213,6 +213,13 @@ impl AbsPath { pub fn exists(&self) -> bool { self.0.exists() } + + pub fn name_and_extension(&self) -> Option<(&str, Option<&str>)> { + Some(( + self.file_stem()?.to_str()?, + self.extension().and_then(|extension| extension.to_str()), + )) + } // endregion:delegate-methods } |