MCPcopy Create free account
hub / github.com/Nariod/RustPacker / absolute_path

Function absolute_path

src/tools.rs:26–38  ·  view source on GitHub ↗
(path: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

24}
25
26pub fn absolute_path(path: impl AsRef<Path>) -> io::Result<PathBuf> {
27 // thanks to https://stackoverflow.com/questions/30511331/getting-the-absolute-path-from-a-pathbuf
28 let path = path.as_ref();
29
30 let absolute_path = if path.is_absolute() {
31 path.to_path_buf()
32 } else {
33 env::current_dir()?.join(path)
34 }
35 .clean();
36
37 Ok(absolute_path)
38}
39
40pub fn write_to_file(content: &[u8], path: &Path) -> Result<(), Box<dyn std::error::Error>> {
41 let mut file = File::create(path)?;

Callers 4

compile_in_containerFunction · 0.85
args_checkerFunction · 0.85

Calls

no outgoing calls

Tested by 2