cli: Fix build --out flag

This commit is contained in:
armaniferrante 2021-08-12 21:26:15 -07:00
parent 8e4870d370
commit e5b797b31f
No known key found for this signature in database
GPG Key ID: 58BEF301E91F7828
1 changed files with 2 additions and 2 deletions

View File

@ -410,7 +410,7 @@ pub fn build(
let cargo = Manifest::discover()?;
let idl_out = match idl {
Some(idl) => Some(PathBuf::from(idl)),
Some(idl) => Some(PathBuf::from(idl).canonicalize()?),
None => {
let cfg_parent = match cfg.path().parent() {
None => return Err(anyhow!("Invalid Anchor.toml")),
@ -754,7 +754,7 @@ fn _build_cwd(idl_out: Option<PathBuf>) -> Result<()> {
if let Some(idl) = extract_idl("src/lib.rs")? {
let out = match idl_out {
None => PathBuf::from(".").join(&idl.name).with_extension("json"),
Some(o) => PathBuf::from(&o.join(&idl.name).with_extension("json")),
Some(o) => o.join(&idl.name).with_extension("json"),
};
write_idl(&idl, OutFile::File(out))?;