File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
branches/snap-stage3/src/libstd Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: 196851c4c92cf850d28bed749ab8c3034c04b9e3
4
+ refs/heads/snap-stage3: a243ea39c3c155ada813c129081772ede8bce3e4
5
5
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Original file line number Diff line number Diff line change @@ -675,7 +675,7 @@ 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 ( ) {
678
+ if p. components . is_empty ( ) && !p . is_absolute ( ) {
679
679
// Not sure what the right behavior is here, but this
680
680
// prevents a bounds check failure later
681
681
return ~[ ] ;
@@ -1607,6 +1607,20 @@ mod tests {
1607
1607
assert!(dirs.is_empty());
1608
1608
}
1609
1609
1610
+ #[test]
1611
+ #[cfg(not(windows))]
1612
+ fn list_dir_root() {
1613
+ let dirs = os::list_dir(&Path(" /"));
1614
+ assert!(dirs.len() > 1);
1615
+ }
1616
+ #[test]
1617
+ #[cfg(windows)]
1618
+ fn list_dir_root() {
1619
+ let dirs = os::list_dir(&Path(" C : \\ ") ) ;
1620
+ assert ! ( dirs. len( ) > 1 ) ;
1621
+ }
1622
+
1623
+
1610
1624
#[ test]
1611
1625
fn path_is_dir ( ) {
1612
1626
assert ! ( ( os:: path_is_dir( & Path ( "." ) ) ) ) ;
You can’t perform that action at this time.
0 commit comments