Skip to content

Commit

Permalink
rustbuild: canonicalize prefix install_sh
Browse files Browse the repository at this point in the history
Testing:
```
  $ git diff
  diff --git a/config.toml.example b/config.toml.example
  index 9dd3002506..b47bc490cd 100644
  --- a/config.toml.example
  +++ b/config.toml.example
  @@ -196,7 +196,7 @@
   [install]

   # Instead of installing to /usr/local, install to this path instead.
  -#prefix = "/usr/local"
  +prefix = "install-prefix"

   # Where to install system configuration files
   # If this is a relative path, it will get installed in `prefix` above
  $ mkdir install-prefix
  $ ./x.py install -i --stage 0 --config config.toml.example
  ...
  $ ls install-prefix/
  bin	lib	share
```

Closes #36989.
  • Loading branch information
tamird committed Apr 8, 2018
1 parent b7da1aa commit 9487902
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bootstrap/install.rs
Expand Up @@ -72,7 +72,9 @@ fn install_sh(
let bindir_default = PathBuf::from("bin");
let libdir_default = PathBuf::from("lib");
let mandir_default = datadir_default.join("man");
let prefix = build.config.prefix.as_ref().unwrap_or(&prefix_default);
let prefix = build.config.prefix.as_ref().map_or(prefix_default, |p| {
fs::canonicalize(p).expect(&format!("could not canonicalize {}", p.display()))
});
let sysconfdir = build.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default);
let datadir = build.config.datadir.as_ref().unwrap_or(&datadir_default);
let docdir = build.config.docdir.as_ref().unwrap_or(&docdir_default);
Expand Down

0 comments on commit 9487902

Please sign in to comment.