Skip to content

Commit c80255e

Browse files
committed
Fix assumption that only os_fs.path_sep can separate paths, sigh.
1 parent f5f2f76 commit c80255e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib/fs.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ fn dirname(path p) -> path {
1313
assert (_str.byte_len(sep) == 1u);
1414
let int i = _str.rindex(p, sep.(0));
1515
if (i == -1) {
16-
ret p;
16+
// FIXME: the '/' character is a path separator on all 3 platforms we
17+
// support. This should probably be generalized a bit more in the
18+
// future, but for now this should work.
19+
i = _str.rindex(p, '/');
20+
if (i == -1) {
21+
ret p;
22+
}
1723
}
1824
ret _str.substr(p, 0u, i as uint);
1925
}

0 commit comments

Comments
 (0)