From f1fc5d3c60c2baf2387dc10ae135a84d7d94a0d3 Mon Sep 17 00:00:00 2001 From: guilleag01 Date: Tue, 18 Feb 2025 22:28:53 +0100 Subject: [PATCH] fixed error when dir is . --- src/compiler.rs | 6 +++++- test/main | Bin 15536 -> 15560 bytes 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler.rs b/src/compiler.rs index f12ca67..4a9d0d5 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -41,7 +41,10 @@ impl Compiler { let mut o_s: Vec = Vec::new(); for file in self.needed_src.clone() { - let o_file = format!("{}.o", file.split(".").collect::>()[0]); + let o_file = format!( + "{}.o", + path::Path::new(&file).with_extension("").to_str().unwrap() + ); let o_path = path::Path::new(&o_file); let mut o_comp = o_path.components(); o_comp.next(); @@ -159,6 +162,7 @@ impl Compiler { .unwrap() .to_string(), ); + (src_file, header_files) } diff --git a/test/main b/test/main index 3e362a4d5798ea2f86fdc6472a20fa21dcbd25ed..79bcc7e712e965bcbd3024a7d17624743fc8eb28 100755 GIT binary patch delta 196 zcmdl`d7^TH2BXJD&2nauh4DMjK6lD4UDB{g+V-<=rvH-s!p&QlXYk7HU;u&_%s^s7 z?BP(4&Zi!|tQ+|l7(6sl_R&3MHwIiPn*$6S7#S@mPc*#F7&$r9sD#r{ tFPQx`C@8;wdh njr5Wkz