Handle error for exists on MMapDirectory (#1988)

`exists` will return false in case of other io errors, like permission denied
This commit is contained in:
PSeitz
2023-04-25 15:20:33 +08:00
committed by GitHub
parent 2e369db936
commit 80df1d9835

View File

@@ -369,7 +369,9 @@ impl Directory for MmapDirectory {
fn exists(&self, path: &Path) -> Result<bool, OpenReadError> {
let full_path = self.resolve_path(path);
Ok(full_path.exists())
full_path
.try_exists()
.map_err(|io_err| OpenReadError::wrap_io_error(io_err, path.to_path_buf()))
}
fn open_write(&self, path: &Path) -> Result<WritePtr, OpenWriteError> {