#[cfg(windows)]
use std::path::PathBuf;
#[cfg(windows)]
pub(crate) fn source_r_profiles(r_args: &[String]) {
arf_harp::override_platform_gui();
let r_home = match std::env::var("R_HOME") {
Ok(path) => PathBuf::from(path),
Err(_) => {
log::warn!("R_HOME not set, skipping R profile sourcing");
return;
}
};
if !arf_harp::should_ignore_site_r_profile(r_args) {
arf_harp::source_site_r_profile(&r_home);
} else {
log::trace!("Skipping site R profile (--no-site-file or --vanilla)");
}
if !arf_harp::should_ignore_user_r_profile(r_args) {
arf_harp::source_user_r_profile();
} else {
log::trace!("Skipping user R profile (--no-init-file or --vanilla)");
}
arf_harp::call_dot_first();
arf_harp::call_dot_first_sys();
}