MCPcopy Create free account
hub / github.com/chatmail/core / get_abs_path

Function get_abs_path

src/tools.rs:342–348  ·  view source on GitHub ↗

Expand paths relative to $BLOBDIR into absolute paths. If `path` starts with "$BLOBDIR", replaces it with the blobdir path. Otherwise, returns path as is.

(context: &Context, path: &Path)

Source from the content-addressed store, hash-verified

340/// If `path` starts with "$BLOBDIR", replaces it with the blobdir path.
341/// Otherwise, returns path as is.
342pub(crate) fn get_abs_path(context: &Context, path: &Path) -> PathBuf {
343 if let Ok(p) = path.strip_prefix("$BLOBDIR") {
344 context.get_blobdir().join(p)
345 } else {
346 path.into()
347 }
348}
349
350pub(crate) async fn get_filebytes(context: &Context, path: &Path) -> Result<u64> {
351 let path_abs = get_abs_path(context, path);

Callers 13

get_config_optMethod · 0.85
set_config_exMethod · 0.85
get_filebytesFunction · 0.85
delete_fileFunction · 0.85
create_folderFunction · 0.85
write_fileFunction · 0.85
read_fileFunction · 0.85
open_fileFunction · 0.85
open_file_stdFunction · 0.85
get_profile_image_exMethod · 0.85
get_profile_imageMethod · 0.85
get_asset_iconFunction · 0.85

Calls 1

get_blobdirMethod · 0.45

Tested by

no test coverage detected