Skip to content

Commit

Permalink
resolve relative paths against PATH during packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
froydnj committed Jan 2, 2020
1 parent 2433a88 commit f893164
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/compiler/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ use std::hash::Hash;
use std::io;
use std::path::{Path, PathBuf};
use std::process;
use which::which;

use crate::errors::*;

Expand Down Expand Up @@ -544,12 +545,13 @@ impl pkg::ToolchainPackager for CToolchainPackager {
output.stdout.pop();
}

// Create our PathBuf from the raw bytes, and return if absolute.
// Create our PathBuf from the raw bytes. Assume that relative
// paths can be found via PATH.
let path: PathBuf = OsString::from_vec(output.stdout).into();
if path.is_absolute() {
Some(path)
} else {
None
which(path).ok()
}
};

Expand Down

0 comments on commit f893164

Please sign in to comment.