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

Function open_file_std

src/tools.rs:518–533  ·  view source on GitHub ↗
(context: &Context, path: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

516}
517
518pub fn open_file_std(context: &Context, path: impl AsRef<Path>) -> Result<std::fs::File> {
519 let path_abs = get_abs_path(context, path.as_ref());
520
521 match std::fs::File::open(path_abs) {
522 Ok(bytes) => Ok(bytes),
523 Err(err) => {
524 warn!(
525 context,
526 "Cannot read \"{}\" or file is empty: {}",
527 path.as_ref().display(),
528 err
529 );
530 Err(err.into())
531 }
532 }
533}
534
535/// Reads directory and returns a vector of directory entries.
536pub async fn read_dir(path: &Path) -> Result<Vec<fs::DirEntry>> {

Callers

nothing calls this directly

Calls 2

get_abs_pathFunction · 0.85
as_refMethod · 0.45

Tested by

no test coverage detected