Adding crate_root_path to crate_graph

This commit is contained in:
Bruno Ortiz 2023-04-08 13:07:25 -03:00
parent 8e687f7afb
commit a3081a6774
10 changed files with 74 additions and 37 deletions

View file

@ -107,10 +107,7 @@ impl VfsPath {
/// Returns `self`'s base name and file extension.
pub fn name_and_extension(&self) -> Option<(&str, Option<&str>)> {
match &self.0 {
VfsPathRepr::PathBuf(p) => Some((
p.file_stem()?.to_str()?,
p.extension().and_then(|extension| extension.to_str()),
)),
VfsPathRepr::PathBuf(p) => p.name_and_extension(),
VfsPathRepr::VirtualPath(p) => p.name_and_extension(),
}
}