rust/hg-core/src/utils/files.rs
changeset 42453 9609430d3625
child 42499 f305f1d7d559
equal deleted inserted replaced
42452:dc5bd66a8270 42453:9609430d3625
       
     1 use std::path::Path;
       
     2 
       
     3 pub fn get_path_from_bytes(bytes: &[u8]) -> &Path {
       
     4     let os_str;
       
     5     #[cfg(unix)]
       
     6     {
       
     7         use std::os::unix::ffi::OsStrExt;
       
     8         os_str = std::ffi::OsStr::from_bytes(bytes);
       
     9     }
       
    10     #[cfg(windows)]
       
    11     {
       
    12         use std::os::windows::ffi::OsStrExt;
       
    13         os_str = std::ffi::OsString::from_wide(bytes);
       
    14     }
       
    15 
       
    16     Path::new(os_str)
       
    17 }