about summary refs log tree commit diff
path: root/src/libnative
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-02-17 09:57:56 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2014-02-18 00:00:38 +1100
commit4f841ee1509fafdf688a3898e01560ae29ee7836 (patch)
tree109fd76eab98758829ab5ebde99d8a8477b1853e /src/libnative
parent35b1b62ddfc31c2e52b65c2f908c0fcbc6465de5 (diff)
downloadrust-4f841ee1509fafdf688a3898e01560ae29ee7836.tar.gz
rust-4f841ee1509fafdf688a3898e01560ae29ee7836.zip
std: make str::from_utf16 return an Option.
The rest of the codebase is moving toward avoiding `fail!` so we do it
here too!
Diffstat (limited to 'src/libnative')
-rw-r--r--src/libnative/io/file.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libnative/io/file.rs b/src/libnative/io/file.rs
index e9c9f51966c..80f5f74c53a 100644
--- a/src/libnative/io/file.rs
+++ b/src/libnative/io/file.rs
@@ -571,7 +571,8 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
                         else {
                             let fp_vec = vec::from_buf(
                                 fp_buf, wcslen(fp_buf) as uint);
-                            let fp_str = str::from_utf16(fp_vec);
+                            let fp_str = str::from_utf16(fp_vec)
+                                    .expect("rust_list_dir_wfd_fp_buf returned invalid UTF-16");
                             paths.push(Path::new(fp_str));
                         }
                         more_files = FindNextFileW(find_handle, wfd_ptr as HANDLE);