diff --git a/src/build.rs b/src/build.rs index b0900267..8f4ca93b 100644 --- a/src/build.rs +++ b/src/build.rs @@ -109,7 +109,10 @@ pub(crate) fn build_plugin( args.push("--release"); } - let mut command = Command::new("cargo").args(&args).spawn()?; + let mut command = Command::new("cargo") + .current_dir(path) + .args(&args) + .spawn()?; let exit_status = command.wait()?; if exit_status.success() { diff --git a/src/main.rs b/src/main.rs index f2df355d..3191e952 100644 --- a/src/main.rs +++ b/src/main.rs @@ -279,9 +279,12 @@ async fn main() -> Result<(), Box> { let path = path.clone().unwrap_or(current_dir.clone()); let wasm_filename = crate::build::wasm_filename(&path)?; // Defaults to joining with the current working directory, not the input path - let output = output + let mut output = output .clone() - .unwrap_or(current_dir.join("dist").join(wasm_filename)); + .unwrap_or(current_dir.join("dist/plugins").join(&wasm_filename)); + if output.is_dir() { + output = output.join(wasm_filename); + } crate::build::build_plugin(&path, output)?; } None => todo!(),