Fix assumption that only os_fs.path_sep can separate paths, sigh.
This commit is contained in:
parent
f5f2f76339
commit
c80255e510
1 changed files with 7 additions and 1 deletions
|
@ -13,7 +13,13 @@ fn dirname(path p) -> path {
|
||||||
assert (_str.byte_len(sep) == 1u);
|
assert (_str.byte_len(sep) == 1u);
|
||||||
let int i = _str.rindex(p, sep.(0));
|
let int i = _str.rindex(p, sep.(0));
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
ret p;
|
// FIXME: the '/' character is a path separator on all 3 platforms we
|
||||||
|
// support. This should probably be generalized a bit more in the
|
||||||
|
// future, but for now this should work.
|
||||||
|
i = _str.rindex(p, '/');
|
||||||
|
if (i == -1) {
|
||||||
|
ret p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ret _str.substr(p, 0u, i as uint);
|
ret _str.substr(p, 0u, i as uint);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue