summaryrefslogtreecommitdiff
path: root/systems/_framework/src/space.rs
diff options
context:
space:
mode:
Diffstat (limited to 'systems/_framework/src/space.rs')
-rw-r--r--systems/_framework/src/space.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/systems/_framework/src/space.rs b/systems/_framework/src/space.rs
index 8a9b2ec..315bf2b 100644
--- a/systems/_framework/src/space.rs
+++ b/systems/_framework/src/space.rs
@@ -376,6 +376,12 @@ impl<T: SpaceRoot> Space<T> {
let path = self.local_path(relative_path)?;
Ok(tokio::fs::write(path, contents).await?)
}
+
+ /// Check if a file or directory exists at the given relative path within the space.
+ pub async fn exists(&self, relative_path: impl AsRef<Path>) -> Result<bool, SpaceError> {
+ let path = self.local_path(relative_path)?;
+ Ok(tokio::fs::try_exists(path).await?)
+ }
}
impl<T: SpaceRoot> From<T> for Space<T> {