From 6e0b977bc843085a8f372276f3049d128426b73c Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 4 Sep 2023 14:59:26 +0100 Subject: [PATCH] libs: add RemotePath::strip_prefix --- libs/remote_storage/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/remote_storage/src/lib.rs b/libs/remote_storage/src/lib.rs index 8e8419cfd8..a92b87632b 100644 --- a/libs/remote_storage/src/lib.rs +++ b/libs/remote_storage/src/lib.rs @@ -111,6 +111,10 @@ impl RemotePath { pub fn extension(&self) -> Option<&str> { self.0.extension()?.to_str() } + + pub fn strip_prefix(&self, p: &RemotePath) -> Result<&Path, std::path::StripPrefixError> { + self.0.strip_prefix(&p.0) + } } /// Storage (potentially remote) API to manage its state.