cl-parser, cl-repl: Add ./[mod].cl to module search path

This commit is contained in:
2025-02-23 02:44:26 -06:00
parent 2fd08193fd
commit e39b390441
2 changed files with 25 additions and 12 deletions

View File

@@ -72,8 +72,7 @@ pub fn run(args: Args) -> Result<(), Box<dyn Error>> {
}
fn load_file(env: &mut Environment, path: impl AsRef<Path>) -> Result<ConValue, Box<dyn Error>> {
let inliner =
cl_parser::inliner::ModuleInliner::new(path.as_ref().parent().unwrap_or(Path::new("")));
let inliner = cl_parser::inliner::ModuleInliner::new(path.as_ref().with_extension(""));
let file = std::fs::read_to_string(path)?;
let code = Parser::new(Lexer::new(&file)).parse()?;
let code = match inliner.inline(code) {