cargo_deb/util/
pathbytes.rs

1#[cfg(unix)]
2use std::os::unix::ffi::OsStrExt;
3use std::path::Path;
4
5pub trait AsUnixPathBytes {
6    fn to_bytes(&self) -> &[u8];
7}
8
9impl AsUnixPathBytes for Path {
10    #[cfg(not(unix))]
11    fn to_bytes(&self) -> &[u8] {
12        self.to_str().unwrap().as_bytes()
13    }
14
15    #[cfg(unix)]
16    fn to_bytes(&self) -> &[u8] {
17        self.as_os_str().as_bytes()
18    }
19}