Skip to content

Commit 211d2d8

Browse files
committed
use xfun::normalize_path everywhere
1 parent a629877 commit 211d2d8

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,6 @@ importFrom(tools,vignetteEngine)
6161
importFrom(utils,browseURL)
6262
importFrom(xfun,base64_encode)
6363
importFrom(xfun,env_option)
64+
importFrom(xfun,normalize_path)
6465
importFrom(yaml,as.yaml)
6566
importFrom(yaml,write_yaml)

R/quarto-package.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
#' @importFrom tools vignetteEngine
1212
#' @importFrom xfun base64_encode
1313
#' @importFrom xfun env_option
14+
#' @importFrom xfun normalize_path
1415
## usethis namespace: end
1516
NULL

R/quarto.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ quarto_path <- function(normalize = TRUE) {
2121
if (!normalize) {
2222
return(quarto_path)
2323
}
24-
normalizePath(quarto_path, winslash = "/", mustWork = FALSE)
24+
xfun::normalize_path(quarto_path)
2525
}
2626

2727
get_quarto_path_env <- function() {
@@ -257,7 +257,7 @@ quarto_binary_sitrep <- function(verbose = TRUE, debug = FALSE) {
257257
return(FALSE)
258258
}
259259

260-
quarto_found <- normalizePath(quarto_found, mustWork = FALSE)
260+
quarto_found <- xfun::normalize_path(quarto_found)
261261

262262
same_config <- TRUE
263263
if (debug) {
@@ -271,8 +271,8 @@ quarto_binary_sitrep <- function(verbose = TRUE, debug = FALSE) {
271271
))
272272
}
273273

274-
quarto_r_env <- normalizePath(get_quarto_path_env(), mustWork = FALSE)
275-
quarto_system <- normalizePath(unname(Sys.which("quarto")), mustWork = FALSE)
274+
quarto_r_env <- xfun::normalize_path(get_quarto_path_env())
275+
quarto_system <- xfun::normalize_path(unname(Sys.which("quarto")))
276276
# quarto R package will use QUARTO_PATH env var with higher priority than latest version on path $PATH
277277
# and RStudio IDE does not use this environment variable
278278
if (!is.na(quarto_r_env) && identical(quarto_r_env, quarto_found)) {
@@ -296,7 +296,7 @@ quarto_binary_sitrep <- function(verbose = TRUE, debug = FALSE) {
296296
# RStudio IDE > Render button will use RSTUDIO_QUARTO env var with higher priority than latest version on path $PATH
297297
rstudio_env <- Sys.getenv("RSTUDIO_QUARTO", unset = NA)
298298
if (!is.na(rstudio_env)) {
299-
rstudio_env <- normalizePath(rstudio_env, mustWork = FALSE)
299+
rstudio_env <- xfun::normalize_path(rstudio_env)
300300
if (!identical(rstudio_env, quarto_found)) {
301301
same_config <- FALSE
302302
if (verbose) {

tests/testthat/helper.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ transform_quarto_cli_in_output <- function(
211211
if (dir_only) {
212212
quarto_found <- dirname(quarto_found)
213213
}
214-
quarto_found_normalized <- normalizePath(quarto_found, mustWork = FALSE)
214+
quarto_found_normalized <- xfun::normalize_path(quarto_found)
215215
# look for non-normalized path
216216
lines <- hide_path(lines, quarto_found)
217217
# look for normalized path

tests/testthat/test-quarto.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test_that("quarto CLI sitrep", {
6464
skip_if_no_quarto()
6565
skip_on_cran()
6666
local_reproducible_output(width = 1000)
67-
dummy_quarto_path <- normalizePath("dummy", mustWork = FALSE)
67+
dummy_quarto_path <- xfun::normalize_path("dummy")
6868
withr::with_envvar(
6969
list(QUARTO_PATH = dummy_quarto_path, RSTUDIO_QUARTO = NA),
7070
expect_snapshot(

0 commit comments

Comments
 (0)