Update FileAssetIo NotFound error to include full path (#821)

This commit is contained in:
rod-salazar 2020-11-10 16:21:41 -08:00 committed by GitHub
parent 096ac4aee8
commit 0c30762ab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,13 +45,14 @@ impl AssetIo for FileAssetIo {
fn load_path<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<Vec<u8>, AssetIoError>> {
Box::pin(async move {
let mut bytes = Vec::new();
match File::open(self.root_path.join(path)) {
let full_path = self.root_path.join(path);
match File::open(&full_path) {
Ok(mut file) => {
file.read_to_end(&mut bytes)?;
}
Err(e) => {
return if e.kind() == std::io::ErrorKind::NotFound {
Err(AssetIoError::NotFound(path.to_owned()))
Err(AssetIoError::NotFound(full_path))
} else {
Err(e.into())
}