diff --git a/src/dir.rs b/src/dir.rs index 9a36645..f5e2e49 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -105,7 +105,7 @@ impl <'a, 'b> Dir<'a, 'b> { for r in self.iter() { let e = r?; // compare name ignoring case - if e.file_name().eq_ignore_ascii_case(name) { + if e.file_name().eq_ignore_ascii_case(name) || e.short_file_name().eq_ignore_ascii_case(name) { return Ok(e); } if let Some(ref mut gen) = short_name_gen { diff --git a/tests/read.rs b/tests/read.rs index accf7da..1df4402 100644 --- a/tests/read.rs +++ b/tests/read.rs @@ -123,6 +123,8 @@ fn test_get_dir_by_path(fs: FileSystem) { let root_names = root_dir2.iter().map(|r| r.unwrap().file_name()).collect::>(); let root_names2 = root_dir.iter().map(|r| r.unwrap().file_name()).collect::>(); assert_eq!(root_names, root_names2); + + root_dir.open_dir("VERY-L~1").unwrap(); } #[test] @@ -147,10 +149,12 @@ fn test_get_file_by_path(fs: FileSystem) { file.read_to_end(&mut buf).unwrap(); assert_eq!(str::from_utf8(&buf).unwrap(), TEST_TEXT); - // let mut file = root_dir.open_file("very-long-dir-name/very-long-file-name.txt").unwrap(); - // let mut buf = Vec::new(); - // file.read_to_end(&mut buf).unwrap(); - // assert_eq!(str::from_utf8(&buf).unwrap(), TEST_TEXT); + let mut file = root_dir.open_file("very-long-dir-name/very-long-file-name.txt").unwrap(); + let mut buf = Vec::new(); + file.read_to_end(&mut buf).unwrap(); + assert_eq!(str::from_utf8(&buf).unwrap(), TEST_TEXT); + + root_dir.open_file("VERY-L~1/VERY-L~1.TXT").unwrap(); } #[test]