use super::r_source::RSourceResolutionReport;
#[cfg_attr(not(unix), allow(unused_variables))]
pub(crate) fn prepare_loader_path(resolution: &RSourceResolutionReport) {
#[cfg(unix)]
let loader_result = arf_libr::ensure_ld_library_path_with_pre_exec(|| {
super::reexec::forward_loader_target(resolution)
});
#[cfg(not(unix))]
let loader_result = arf_libr::ensure_ld_library_path();
if let Err(e) = loader_result {
log::warn!("Could not prepare the R library search path: {}", e);
}
#[cfg(unix)]
super::reexec::clear_loader_target();
}
#[cfg(unix)]
pub(crate) fn prepare_loader_path_with_args(
resolution: &RSourceResolutionReport,
args: &[std::ffi::OsString],
pre_exec: impl FnOnce(),
) -> arf_libr::RResult<bool> {
let result = arf_libr::ensure_ld_library_path_with_pre_exec_and_args(args, || {
super::reexec::forward_loader_target(resolution);
pre_exec();
});
super::reexec::clear_loader_target();
result
}