From 164492d2df28d54135bd762991899f55f990a6e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kostrubiec?= Date: Sat, 14 Sep 2024 14:45:13 +0200 Subject: [PATCH] Another fix to argument parsing in windows. --- cilly/src/bin/linker/main.rs | 2 +- cilly/src/bin/optsect.rs | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cilly/src/bin/linker/main.rs b/cilly/src/bin/linker/main.rs index 22db24f3..7d898ffa 100644 --- a/cilly/src/bin/linker/main.rs +++ b/cilly/src/bin/linker/main.rs @@ -140,7 +140,7 @@ fn get_out_path(args: &[String]) -> &str { #[cfg(target_os = "windows")] fn get_out_path<'a>(args: &'a [String]) -> &'a str { args.iter() - .filter_map(|arg| arg.strip_suffix("/OUT:")) + .filter_map(|arg| arg.strip_preffix("/OUT:")) .next() .expect(&format!("No output file! {args:?}")) } diff --git a/cilly/src/bin/optsect.rs b/cilly/src/bin/optsect.rs index 42dde36a..a708f9b6 100644 --- a/cilly/src/bin/optsect.rs +++ b/cilly/src/bin/optsect.rs @@ -1,4 +1,4 @@ -use std::io::Read; +use std::io::{Read, Write}; use cilly::v2::{asm::ILASM_FLAVOUR, il_exporter::ILExporter, opt::OptFuel, Assembly}; @@ -41,6 +41,14 @@ fn main() { path.set_extension("exe"); asm.export(&path, ILExporter::new(*ILASM_FLAVOUR, false)); eprintln!("Exported in {} ms", export_time.elapsed().as_millis()); + let mut config_path = std::env::temp_dir(); + config_path.push("asm"); + config_path.set_extension("runtimeconfig.json"); + let cfg = cilly::v2::il_exporter::get_runtime_config(); + std::fs::File::create(config_path) + .unwrap() + .write_all(cfg.as_bytes()) + .unwrap(); let run_time = std::time::Instant::now(); let out = std::process::Command::new("dotnet") .arg(path) @@ -55,7 +63,10 @@ fn main() { } else { fuel_start = fuel_mid; } - eprintln!("Run the result in in {} ms", run_time.elapsed().as_millis()); + eprintln!( + "Run the result in in {} ms. fail:{fail}", + run_time.elapsed().as_millis() + ); } eprintln!("Done. fuel_start:{fuel_start} fuel_end:{fuel_end}"); }