Skip to content

Commit

Permalink
Stick with the status quo
Browse files Browse the repository at this point in the history
It appears this is what cli has always done with a leading `./`, so just keep doing that until there's reason not to.
  • Loading branch information
jennybc committed Jan 10, 2025
1 parent 9316386 commit 79bbe8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/ansi-hyperlink.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ construct_file_link <- function(params) {

params$path <- sub("^file://", "", params$path)
params$path <- path.expand(params$path)

looks_absolute <- function(path) {
grepl("^/", params$path) || (is_windows() && grepl("^[a-zA-Z]:", params$path))
}
Expand Down
19 changes: 12 additions & 7 deletions tests/testthat/test-ansi-hyperlink.R
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,18 @@ test_that("construct_file_link() works with custom format and a relative path",
"positron://file/working/directory/relative/path:12:5"
)

# FAILING, what do I want to do here?
# expect_equal(
# sanitize_wd2(construct_file_link(list(path = "./relative/path"))),
# "positron://file/working/directory/relative/path"
# )
# line
# line and column
expect_equal(
sanitize_dir(construct_file_link(list(path = "./relative/path")), what = "wd"),
"positron://file/working/directory/./relative/path"
)
expect_equal(
sanitize_dir(construct_file_link(list(path = "./relative/path:12")), what = "wd"),
"positron://file/working/directory/./relative/path:12"
)
expect_equal(
sanitize_dir(construct_file_link(list(path = "./relative/path:12:5")), what = "wd"),
"positron://file/working/directory/./relative/path:12:5"
)

expect_equal(
sanitize_dir(construct_file_link(list(path = "~/relative/path")), what = "home"),
Expand Down

0 comments on commit 79bbe8f

Please sign in to comment.