aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-05-05 13:42:52 -0700
committerGraydon Hoare <[email protected]>2011-05-05 13:42:52 -0700
commitc80255e51076239163914c696aad2af6dff8e6e9 (patch)
tree2a1131d23376adaefa1b73f2073e4455e820d4c2 /src/lib
parentAdd --help, --version and -v flags (not yet supporting GIT_REV env var, waiti... (diff)
downloadrust-c80255e51076239163914c696aad2af6dff8e6e9.tar.xz
rust-c80255e51076239163914c696aad2af6dff8e6e9.zip
Fix assumption that only os_fs.path_sep can separate paths, sigh.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/fs.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/fs.rs b/src/lib/fs.rs
index e185ca3e..722f2661 100644
--- a/src/lib/fs.rs
+++ b/src/lib/fs.rs
@@ -13,7 +13,13 @@ fn dirname(path p) -> path {
assert (_str.byte_len(sep) == 1u);
let int i = _str.rindex(p, sep.(0));
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);
}