Skip to content

Commit 69616d7

Browse files
committed
---
yaml --- r: 107622 b: refs/heads/dist-snap c: 8cce35e h: refs/heads/master v: v3
1 parent 22edad0 commit 69616d7

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: cdd146b8954d704a07a4445f00ef8ed0f65da096
9+
refs/heads/dist-snap: 8cce35e490ce259244656e12d272ab1915b0541b
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/metadata/filesearch.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,24 @@ fn make_rustpkg_target_lib_path(dir: &Path,
160160
}
161161

162162
pub fn get_or_default_sysroot() -> Path {
163-
match os::self_exe_path() {
164-
option::Some(p) => { let mut p = p; p.pop(); p }
163+
// Follow symlinks. If the resolved path is relative, make it absolute.
164+
fn canonicalize(path: Option<Path>) -> Option<Path> {
165+
path.and_then(|mut path|
166+
match io::io_error::cond.trap(|_| ()).inside(|| fs::readlink(&path)) {
167+
Some(canon) => {
168+
if canon.is_absolute() {
169+
Some(canon)
170+
} else {
171+
path.pop();
172+
Some(path.join(canon))
173+
}
174+
},
175+
None => Some(path),
176+
})
177+
}
178+
179+
match canonicalize(os::self_exe_name()) {
180+
option::Some(p) => { let mut p = p; p.pop(); p.pop(); p }
165181
option::None => fail!("can't determine value for sysroot")
166182
}
167183
}

0 commit comments

Comments
 (0)