From 9c91a472fda35e61850df146944df7471906c60c Mon Sep 17 00:00:00 2001 From: Egor Kotov Date: Tue, 20 Aug 2024 15:50:13 +0200 Subject: [PATCH] fix temp dir behaviour --- R/java_download.R | 4 +++- R/java_quick_install.R | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/R/java_download.R b/R/java_download.R index 966f7e8..f954721 100644 --- a/R/java_download.R +++ b/R/java_download.R @@ -34,7 +34,9 @@ java_download <- function( if (temp_dir) { temp_dir <- tempdir() setwd(temp_dir) - dir.create("rJavaEnv_cache", recursive = TRUE) + if (!dir.exists("rJavaEnv_cache")) { + dir.create("rJavaEnv_cache", recursive = TRUE) + } cache_path <- file.path(temp_dir, "rJavaEnv_cache") } diff --git a/R/java_quick_install.R b/R/java_quick_install.R index 0a81125..abb1c22 100644 --- a/R/java_quick_install.R +++ b/R/java_quick_install.R @@ -26,9 +26,13 @@ java_quick_install <- function( if (temp_dir) { temp_dir <- tempdir() setwd(temp_dir) - dir.create("rJavaEnv_cache", recursive = TRUE) + if (!dir.exists("rJavaEnv_cache")) { + dir.create("rJavaEnv_cache", recursive = TRUE) + } cache_path <- file.path(temp_dir, "rJavaEnv_cache") - dir.create("rJavaEnv_project", recursive = TRUE) + if (!dir.exists("rJavaEnv_project")) { + dir.create("rJavaEnv_project", recursive = TRUE) + } project_path <- file.path(temp_dir, "rJavaEnv_project") } else { cache_path <- getOption("rJavaEnv.cache_path")