Skip to content

Commit

Permalink
Don't hardcode target/ directory, get it from cargo Workspace. Fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla committed Feb 26, 2017
1 parent 409fdf5 commit 1068771
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn run_coverage(ws: &Workspace, options: &CoverageOptions, test_args: &[Stri
let mut cmd = try!(compilation.target_process(options.kcov_path, pkg));
// TODO: Make all that more configurable
//TODO: The unwraps shouldn't cause problems... right ?
let target = "target/kcov-".to_string() + to_display.file_name().unwrap().to_str().unwrap();
let target = ws.target_dir().join("kcov-".to_string() + to_display.file_name().unwrap().to_str().unwrap()).into_path_unlocked();
let mut args : Vec<&std::ffi::OsStr> = vec!["--verify".as_ref(), "--exclude-pattern=/.cargo".as_ref(), target.as_ref()];
args.push(exe.as_os_str());
let w : Vec<&std::ffi::OsStr> = v.iter().map(|v| v.as_os_str()).collect();
Expand All @@ -63,7 +63,7 @@ pub fn run_coverage(ws: &Workspace, options: &CoverageOptions, test_args: &[Stri
let mut mergeargs : Vec<OsString> = vec!["--merge".to_string().into(), options.merge_dir.as_os_str().to_os_string()];
mergeargs.extend(options.merge_args.iter().cloned());
mergeargs.extend(compilation.tests.iter().map(|&(_, _, ref exe)|
("target/kcov-".to_string() + exe.file_name().unwrap().to_str().unwrap()).into()
ws.target_dir().join("kcov-".to_string() + exe.file_name().unwrap().to_str().unwrap()).into_path_unlocked().into()
));
let mut cmd = process(options.kcov_path.as_os_str().to_os_string());
cmd.args(&mergeargs);
Expand Down

0 comments on commit 1068771

Please sign in to comment.