Skip to content

Commit 939b7d5

Browse files
committed
---
yaml --- r: 60707 b: refs/heads/auto c: a243ea3 h: refs/heads/master i: 60705: b2bdeef 60703: 254be97 v: v3
1 parent 7c16143 commit 939b7d5

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 196851c4c92cf850d28bed749ab8c3034c04b9e3
17+
refs/heads/auto: a243ea39c3c155ada813c129081772ede8bce3e4
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libstd/os.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ pub fn mkdir_recursive(p: &Path, mode: c_int) -> bool {
675675
/// Lists the contents of a directory
676676
#[allow(non_implicitly_copyable_typarams)]
677677
pub fn list_dir(p: &Path) -> ~[~str] {
678-
if p.components.is_empty() {
678+
if p.components.is_empty() && !p.is_absolute() {
679679
// Not sure what the right behavior is here, but this
680680
// prevents a bounds check failure later
681681
return ~[];
@@ -1607,6 +1607,20 @@ mod tests {
16071607
assert!(dirs.is_empty());
16081608
}
16091609
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+
16101624
#[test]
16111625
fn path_is_dir() {
16121626
assert!((os::path_is_dir(&Path("."))));

0 commit comments

Comments
 (0)