File size: 362 Bytes
84d2a97
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
use std::path::Path;

use crate::common::operation_error::{OperationError, OperationResult};

pub fn strip_prefix<'a>(path: &'a Path, prefix: &Path) -> OperationResult<&'a Path> {
    path.strip_prefix(prefix).map_err(|err| {
        OperationError::service_error(format!(
            "failed to strip {prefix:?} prefix from {path:?}: {err}"
        ))
    })
}