With some luck windows will now test too
@@ -15,14 +15,23 @@ struct CommandOutput<'a> {
stderr: BString,
}
+fn binary_name(name: &str) -> &str {
+ if cfg!(windows) {
+ format!("{}.exe", name)
+ } else {
+ name
+ }
+}
+
fn binary_path(name: &str) -> Result<PathBuf, String> {
+ let executable = binary_name(name);
let manifest_path =
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR environment variable not set by cargo");
- let path = PathBuf::from(manifest_path).join("target").join("debug").join(name);
+ let path = PathBuf::from(manifest_path).join("target").join("debug").join(executable);
match path.exists() {
true => Ok(path),
- false => Err(format!("Can't find binary {} in ./target/debug/", name)),
+ false => Err(format!("Can't find binary {} in ./target/debug/", executable)),
}
}
