MCPcopy Create free account
hub / github.com/archlinux/alpm / new

Method new

alpm-package/src/input.rs:126–143  ·  view source on GitHub ↗

Creates a new [`InputDir`] from `path`. # Errors Returns an error if - `path` is not absolute, - `path` does not exist, - the metadata of `path` cannot be retrieved, - or `path` is not a directory.

(path: PathBuf)

Source from the content-addressed store, hash-verified

124 /// - the metadata of `path` cannot be retrieved,
125 /// - or `path` is not a directory.
126 pub fn new(path: PathBuf) -> Result<Self, crate::Error> {
127 if !path.is_absolute() {
128 return Err(alpm_common::Error::NonAbsolutePaths {
129 paths: vec![path.clone()],
130 }
131 .into());
132 }
133
134 if !path.exists() {
135 return Err(crate::Error::PathDoesNotExist { path: path.clone() });
136 }
137
138 if !path.is_dir() {
139 return Err(alpm_common::Error::NotADirectory { path: path.clone() }.into());
140 }
141
142 Ok(Self(path))
143 }
144
145 /// Coerces to a Path slice.
146 ///

Callers

nothing calls this directly

Calls 1

is_dirMethod · 0.80

Tested by

no test coverage detected