Fixed macro system by reintroducing MacTok::Resolved

This commit is contained in:
2026-04-16 20:12:28 +00:00
parent 23180b66e3
commit 286040c3ec
14 changed files with 130 additions and 58 deletions

View File

@@ -109,6 +109,12 @@ fn get_all_extensions<'a>(
}
try_stream(async |mut cx| {
for ext_path in args.extension.iter() {
let Some(file_name) = ext_path.file_name() else {
return Err(io::Error::new(
std::io::ErrorKind::IsADirectory,
format!("Extensions are always files, but {ext_path} points at a directory"),
));
};
let init = if cfg!(windows) {
if ext_path.with_extension("dll").exists() {
ext_dylib(ext_path.with_extension("dll").as_std_path(), ctx.clone()).await.unwrap()
@@ -117,12 +123,15 @@ fn get_all_extensions<'a>(
} else {
return Err(not_found_error(ext_path));
}
} else if ext_path.with_extension("so").exists() {
ext_dylib(ext_path.with_extension("so").as_std_path(), ctx.clone()).await.unwrap()
} else if ext_path.exists() {
ext_command(Command::new(ext_path.as_os_str()), ctx.clone()).await?
} else {
return Err(not_found_error(ext_path));
let lib_path = ext_path.with_file_name(format!("lib{file_name}.so"));
if lib_path.exists() {
ext_dylib(lib_path.as_std_path(), ctx.clone()).await.unwrap()
} else if ext_path.exists() {
ext_command(Command::new(ext_path.as_os_str()), ctx.clone()).await?
} else {
return Err(not_found_error(ext_path));
}
};
cx.emit(Extension::new(init, ctx.clone()).await?).await;
}