Skip to content

Commit

Permalink
Port nullfile() as file_null() to avoid depending on R >= 3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nanxstats committed Jun 3, 2024
1 parent 4d2d85e commit c2bf1bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/rtf_strwidth.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ safe_strwidth <- function(text, ...) with_bmp(graphics::strwidth(text, ...))
#' @noRd
with_bmp <- function(expr) {
expr <- substitute(expr)
grDevices::bmp(nullfile())
grDevices::bmp(file_null())
on.exit(
{
current <- grDevices::dev.cur()
Expand All @@ -164,3 +164,5 @@ with_bmp <- function(expr) {
)
eval(expr, envir = parent.frame())
}

file_null <- function() if (.Platform$OS.type == "windows") "nul:" else "/dev/null"

0 comments on commit c2bf1bc

Please sign in to comment.