1 2 3 4 5 6 7 8 9 10 11 12 13
// From git2 crate
#[cfg(unix)]
pub(crate) fn bytes2path(b: &[u8]) -> &std::path::Path {
use std::os::unix::prelude::*;
std::path::Path::new(std::ffi::OsStr::from_bytes(b))
}
// From git2 crate
#[cfg(windows)]
pub(crate) fn bytes2path(b: &[u8]) -> &std::path::Path {
use std::str;
std::path::Path::new(str::from_utf8(b).unwrap())
}