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