From cfe015c5b65580f217a96017da29aa13dc84e689 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Wed, 18 Dec 2024 13:31:57 -0800 Subject: [PATCH] Possible fix for Windows --- R/ansi-hyperlink.R | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/R/ansi-hyperlink.R b/R/ansi-hyperlink.R index cef98104..168b84a3 100644 --- a/R/ansi-hyperlink.R +++ b/R/ansi-hyperlink.R @@ -101,13 +101,11 @@ construct_file_link <- function(params) { params$path <- sub("^file://", "", params$path) params$path <- path.expand(params$path) - looks_absolute <- - grepl("^/", params$path) || (is_windows() && grepl("^[a-zA-Z]:", params$path)) - if (looks_absolute) { - if (is_windows()) { - params$path <- paste0("/", params$path) - } - } else { + if (is_windows() && grepl("^[a-zA-Z]:", params$path)) { + params$path <- paste0("/", params$path) + } + looks_absolute <- grepl("^/", params$path) + if (!looks_absolute) { params$path <- file.path(getwd(), params$path) }