Update FileAssetIo NotFound error to include full path (#821)
This commit is contained in:
parent
096ac4aee8
commit
0c30762ab7
@ -45,13 +45,14 @@ impl AssetIo for FileAssetIo {
|
|||||||
fn load_path<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<Vec<u8>, AssetIoError>> {
|
fn load_path<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<Vec<u8>, AssetIoError>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut bytes = Vec::new();
|
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) => {
|
Ok(mut file) => {
|
||||||
file.read_to_end(&mut bytes)?;
|
file.read_to_end(&mut bytes)?;
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return if e.kind() == std::io::ErrorKind::NotFound {
|
return if e.kind() == std::io::ErrorKind::NotFound {
|
||||||
Err(AssetIoError::NotFound(path.to_owned()))
|
Err(AssetIoError::NotFound(full_path))
|
||||||
} else {
|
} else {
|
||||||
Err(e.into())
|
Err(e.into())
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user