file_storage/op/file/exists/exists.rs
1use crate::LocalPath;
2use crate::Operation::Exists;
3use crate::Reason::UnknownFileSystem;
4use crate::{Error, FilePath};
5
6impl FilePath {
7 //! Exists
8
9 /// Checks if the file exists.
10 pub fn exists(&self) -> Result<bool, Error> {
11 if let Some(path) = LocalPath::from(self.path()) {
12 return path.exists();
13 }
14
15 Err(Error::new(self.clone(), Exists, UnknownFileSystem))
16 }
17}