##// END OF EJS Templates
rust-filepatterns: add comment about Windows path handling...
Yuya Nishihara -
r42684:f305f1d7 default
parent child Browse files
Show More
@@ -1,17 +1,19 b''
1 1 use std::path::Path;
2 2
3 3 pub fn get_path_from_bytes(bytes: &[u8]) -> &Path {
4 4 let os_str;
5 5 #[cfg(unix)]
6 6 {
7 7 use std::os::unix::ffi::OsStrExt;
8 8 os_str = std::ffi::OsStr::from_bytes(bytes);
9 9 }
10 10 #[cfg(windows)]
11 11 {
12 // TODO: convert from Windows MBCS (ANSI encoding) to WTF8.
13 // Perhaps, the return type would have to be Result<PathBuf>.
12 14 use std::os::windows::ffi::OsStrExt;
13 15 os_str = std::ffi::OsString::from_wide(bytes);
14 16 }
15 17
16 18 Path::new(os_str)
17 19 }
General Comments 0
You need to be logged in to leave comments. Login now