Only parse first build argument as path if it does not start with hyphens

master
Frederic Kettelhoit 4 years ago
parent 5b1bd1af1f
commit dafc83d49d
  1. 10
      src/command/build.rs

@ -184,7 +184,15 @@ type BuildStep = fn(&mut Build) -> Result<(), Error>;
impl Build {
/// Construct a build command from the given options.
pub fn try_from_opts(build_opts: BuildOptions) -> Result<Self, Error> {
pub fn try_from_opts(mut build_opts: BuildOptions) -> Result<Self, Error> {
if let Some(path) = &build_opts.path {
if path.to_string_lossy().starts_with("--") {
let path = build_opts.path.take().unwrap();
build_opts
.extra_options
.insert(0, path.to_string_lossy().into_owned().to_string());
}
}
let crate_path = get_crate_path(build_opts.path)?;
let crate_data = manifest::CrateData::new(&crate_path, build_opts.out_name.clone())?;
let out_dir = crate_path.join(PathBuf::from(build_opts.out_dir));

Loading…
Cancel
Save