mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-12 23:13:15 +00:00
Fix rpath bug.
This commit is contained in:
parent
a736669fb6
commit
f6ecbe88ca
@ -218,8 +218,8 @@ mod test {
|
||||
#[test]
|
||||
fn test_prefix_rpath() {
|
||||
let res = get_install_prefix_rpath("/usr/lib", "triple");
|
||||
assert str::ends_with(res, #env("CFG_PREFIX")
|
||||
+ "/lib/rustc/triple/lib");
|
||||
let d = fs::connect(#env("CFG_PREFIX"), "/lib/rustc/triple/lib");
|
||||
assert str::ends_with(res, d);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -81,17 +81,20 @@ Function: connect
|
||||
|
||||
Connects to path segments
|
||||
|
||||
Given paths `pre` and `post` this function will return a path
|
||||
that is equal to `post` appended to `pre`, inserting a path separator
|
||||
between the two as needed.
|
||||
Given paths `pre` and `post, removes any trailing path separator on `pre` and
|
||||
any leading path separator on `post`, and returns the concatenation of the two
|
||||
with a single path separator between them.
|
||||
*/
|
||||
fn connect(pre: path, post: path) -> path {
|
||||
let len = str::byte_len(pre);
|
||||
ret if pre[len - 1u] == os_fs::path_sep as u8 {
|
||||
|
||||
// Trailing '/'?
|
||||
pre + post
|
||||
} else { pre + path_sep() + post };
|
||||
fn connect(pre: path, post: path) -> path {
|
||||
let pre_ = pre;
|
||||
let post_ = post;
|
||||
let sep = os_fs::path_sep as u8;
|
||||
let pre_len = str::byte_len(pre);
|
||||
let post_len = str::byte_len(post);
|
||||
if pre_len > 1u && pre[pre_len-1u] == sep { str::pop_byte(pre_); }
|
||||
if post_len > 1u && post[0] == sep { str::shift_byte(post_); }
|
||||
ret pre_ + path_sep() + post_;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user