##// END OF EJS Templates
py3: add r'' prefixes and do ('%d' % int) instead of str(int)...
py3: add r'' prefixes and do ('%d' % int) instead of str(int) This addresses more failures related to zeroconf on py3. Differential Revision: https://phab.mercurial-scm.org/D6510

File last commit:

r42684:f305f1d7 default
r42753:683aeef1 default
Show More
files.rs
19 lines | 509 B | application/rls-services+xml | RustLexer
use std::path::Path;
pub fn get_path_from_bytes(bytes: &[u8]) -> &Path {
let os_str;
#[cfg(unix)]
{
use std::os::unix::ffi::OsStrExt;
os_str = std::ffi::OsStr::from_bytes(bytes);
}
#[cfg(windows)]
{
// TODO: convert from Windows MBCS (ANSI encoding) to WTF8.
// Perhaps, the return type would have to be Result<PathBuf>.
use std::os::windows::ffi::OsStrExt;
os_str = std::ffi::OsString::from_wide(bytes);
}
Path::new(os_str)
}