MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / prepare_path

Method prepare_path

src/pglite/sync_host_fs.rs:30–46  ·  view source on GitHub ↗
(&self, path: &Path)

Source from the content-addressed store, hash-verified

28 }
29
30 fn prepare_path(&self, path: &Path) -> virtual_fs::Result<PathBuf> {
31 let path = normalize_path(path);
32
33 if matches!(path.components().next(), Some(Component::Prefix(..))) {
34 return Err(FsError::InvalidInput);
35 }
36
37 if self.root != Path::new("/") && path.starts_with(&self.root) {
38 return Err(FsError::InvalidInput);
39 }
40
41 let path = path.strip_prefix("/").unwrap_or(&path);
42 let path = self.root.join(path);
43
44 debug_assert!(path.starts_with(&self.root));
45 Ok(path)
46 }
47}
48
49impl virtual_fs::FileSystem for SyncHostFileSystem {

Callers 9

readlinkMethod · 0.80
read_dirMethod · 0.80
create_dirMethod · 0.80
remove_dirMethod · 0.80
renameMethod · 0.80
metadataMethod · 0.80
symlink_metadataMethod · 0.80
remove_fileMethod · 0.80
openMethod · 0.80

Calls 2

normalize_pathFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected