Skip to content

Commit f110d94

Browse files
authored
Use exact same approach in R_PROFILE_USER that we use for R_PROFILE (#968)
1 parent 63be641 commit f110d94

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

crates/ark/src/startup.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,19 @@ fn find_site_r_profile(r_home: &PathBuf) -> Option<PathBuf> {
150150
fn find_user_r_profile() -> Option<PathBuf> {
151151
// Try from env var first
152152
match std::env::var("R_PROFILE_USER") {
153-
Ok(path) => return PathBuf::from_str(path.as_str()).ok(),
153+
Ok(path) => {
154+
if let Some(path) = PathBuf::from_str(path.as_str()).log_err() {
155+
if !path.exists() {
156+
log::warn!(
157+
"`R_PROFILE_USER` detected but '{path}' does not exist",
158+
path = path.to_string_lossy()
159+
);
160+
return None;
161+
} else {
162+
return Some(path);
163+
}
164+
}
165+
},
154166
Err(_) => (),
155167
};
156168

0 commit comments

Comments
 (0)