From 14aa8e278aebcb264ca33b5f8c7e868f598e4fe0 Mon Sep 17 00:00:00 2001 From: Kara Woo Date: Fri, 13 Mar 2026 16:00:52 -0700 Subject: [PATCH 1/2] fix directory checking --- R/utils.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index 09b69974..f5f2f580 100644 --- a/R/utils.R +++ b/R/utils.R @@ -776,8 +776,11 @@ ensureDirectory <- function(path) { return(path) } else if (identical(info$isdir, FALSE)) { stop("path '", path, "' exists but is not a directory") - } else if (!dir.create(path, recursive = TRUE)) { - stop("failed to create directory at path '", path, "'") + } else { + dir.create(path, recursive = TRUE, showWarnings = FALSE) + if (!dir.exists(path)) { + stop("failed to create directory at path '", path, "'") + } } path From c19fef63c728ad85e9dad54cd3d858f23ab98941 Mon Sep 17 00:00:00 2001 From: Kara Woo Date: Thu, 19 Mar 2026 12:45:06 -0700 Subject: [PATCH 2/2] file.info()$isdir to support R<3.2.0 --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index f5f2f580..c3355ab2 100644 --- a/R/utils.R +++ b/R/utils.R @@ -778,7 +778,7 @@ ensureDirectory <- function(path) { stop("path '", path, "' exists but is not a directory") } else { dir.create(path, recursive = TRUE, showWarnings = FALSE) - if (!dir.exists(path)) { + if (!file.info(path)$isdir) { stop("failed to create directory at path '", path, "'") } }