Skip to content

Commit

Permalink
Possible fix for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jennybc committed Dec 18, 2024
1 parent 544507e commit cfe015c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions R/ansi-hyperlink.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit cfe015c

Please sign in to comment.