cargo_quickinstall/utils.rs
1use home::cargo_home;
2use std::{io, path::PathBuf};
3
4pub fn utf8_to_string_lossy(bytes: Vec<u8>) -> String {
5 String::from_utf8(bytes)
6 .unwrap_or_else(|err| String::from_utf8_lossy(err.as_bytes()).into_owned())
7}
8
9pub fn get_cargo_bin_dir() -> io::Result<PathBuf> {
10 let mut cargo_bin_dir = cargo_home()?;
11 cargo_bin_dir.push("bin");
12 Ok(cargo_bin_dir)
13}