File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: e2f8b51dc599cf1fb7f3f72252bef5e5b717f6bd
8
+ refs/heads/try2: 196851c4c92cf850d28bed749ab8c3034c04b9e3
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -675,6 +675,11 @@ pub fn mkdir_recursive(p: &Path, mode: c_int) -> bool {
675
675
/// Lists the contents of a directory
676
676
#[ allow( non_implicitly_copyable_typarams) ]
677
677
pub fn list_dir ( p : & Path ) -> ~[ ~str ] {
678
+ if p. components . is_empty ( ) {
679
+ // Not sure what the right behavior is here, but this
680
+ // prevents a bounds check failure later
681
+ return ~[ ] ;
682
+ }
678
683
unsafe {
679
684
#[ cfg( target_os = "linux" ) ]
680
685
#[ cfg( target_os = "android" ) ]
@@ -1596,6 +1601,12 @@ mod tests {
1596
1601
}
1597
1602
}
1598
1603
1604
+ #[test]
1605
+ fn list_dir_empty_path() {
1606
+ let dirs = os::list_dir(&Path(" "));
1607
+ assert!(dirs.is_empty());
1608
+ }
1609
+
1599
1610
#[test]
1600
1611
fn path_is_dir() {
1601
1612
assert!((os::path_is_dir(&Path(" . "))));
You can’t perform that action at this time.
0 commit comments