Skip to content

Commit

Permalink
fix project path handling and printing in java_env_set
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kotov committed Aug 20, 2024
1 parent 188a4ce commit 4caddb4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/java_env.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
java_env_set <- function(
where = c("session", "both", "project"),
java_home,
project_path,
project_path = NULL,
verbose = TRUE
) {
rje_consent_check()
Expand All @@ -57,11 +57,17 @@ java_env_set <- function(
}

if (where %in% c("project", "both")) {
# consistent with renv behavior for using
# the current working directory by default
# https://github.com/rstudio/renv/blob/d6bced36afa0ad56719ca78be6773e9b4bbb078f/R/init.R#L69-L86
project_path <- ifelse(is.null(project_path), getwd(), project_path)

java_env_set_rprofile(java_home, project_path = project_path)

if (verbose) {
cli::cli_alert_success(c(
"Current R Project/Working Directory: ",
"JAVA_HOME and PATH set to '{.path {java_home}}' in .Rprofile in '{.path {project_path, \".Rprofile\")}}'"
"JAVA_HOME and PATH set to '{.path {java_home}}' in .Rprofile at '{.path {project_path}}'"
))
}
}
Expand Down

0 comments on commit 4caddb4

Please sign in to comment.