use name as file name when file name None

This commit is contained in:
dvvvvvv 2020-02-04 22:57:29 +09:00 committed by Abin Simon
parent f39162dba9
commit ace04d6b39

View file

@ -45,7 +45,7 @@ impl Name {
}
pub fn file_name(&self) -> &str {
self.path.file_name().and_then(OsStr::to_str).unwrap()
self.path.file_name().and_then(OsStr::to_str).unwrap_or(&self.name)
}
fn relative_path<T: AsRef<Path> + Clone>(&self, base_path: T) -> PathBuf {