Skip to content

Commit

Permalink
Another fix to argument parsing in windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
FractalFir committed Sep 14, 2024
1 parent a3dd511 commit 164492d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cilly/src/bin/linker/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}"))
}
Expand Down
15 changes: 13 additions & 2 deletions cilly/src/bin/optsect.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -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)
Expand All @@ -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}");
}

0 comments on commit 164492d

Please sign in to comment.