From f2daf071773fe10ea737e2e9e14c9a1242925efb Mon Sep 17 00:00:00 2001 From: Enrico Zandomeni Borba Date: Mon, 29 Apr 2024 14:27:49 +0200 Subject: [PATCH] bugfix: put compiled binary in next to source file --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index f8076d3f..1604762b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,7 @@ use hvmc::{ use parking_lot::Mutex; use std::{ + ffi::OsStr, fmt::Write, fs::{self, File}, io::{self, BufRead}, @@ -33,10 +34,11 @@ fn main() { CliMode::Compile { file, dylib, transform_args, output } => { let output = if let Some(output) = output { output - } else if let Some(file_stem) = file.file_stem() { - file_stem.into() + } else if let Some("hvmc") = file.extension().and_then(OsStr::to_str) { + file.with_extension("") } else { eprintln!("file missing `.hvmc` extension; explicitly specify an output path with `--output`."); + process::exit(1); };