Skip to content

Commit

Permalink
fix yihui/litedown#29: call browseURL() to open the app (getOptions('…
Browse files Browse the repository at this point in the history
…browser') is not a function in a normal R session outside RStudio)
  • Loading branch information
yihui committed Sep 30, 2024
1 parent e06c5d7 commit 7b6ec53
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: xfun
Type: Package
Title: Supporting Functions for Packages Maintained by 'Yihui Xie'
Version: 0.47.5
Version: 0.47.6
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
person("Wush", "Wu", role = "ctb"),
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

- `base_pkgs()` is faster now: it calls `tools::standard_package_names()` if the function exists (R >= 4.4.0), otherwise it just returns a constant vector of base package names (thanks, @arnaudgallou, #91).

- Added a function `mime_type()` to obtain the MIME types of files via `mime::guess_type()` if **mime** is installed, otherwise it will call a system command (e.g., `file --mime-type`) to obtain the types.
- Added a function `mime_type()` to obtain the MIME types of files via `mime::guess_type()` if **mime** is installed, otherwise it will call `tools:::mime_type()`, and fall back to using a system command (e.g., `file --mime-type`) to obtain the types.

- `new_app()` will use `utils::browseURL()` to open the app if `options('viewer')` is not configured (thanks, @AlbertLei, yihui/litedown#29).

# CHANGES IN xfun VERSION 0.47

Expand Down
2 changes: 1 addition & 1 deletion R/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ new_app = function(name, handler, open = interactive(), ports = 4321 + 1:10) {
# to anyone who sees the dirty assign() here, please close your eyes and walk
# away as quickly as possible; thanks!
assign(name, h, envir = getFromNamespace('.httpd.handlers.env', 'tools'))
if (isTRUE(open)) open = getOption('viewer', getOption('browser'))
if (isTRUE(open)) open = getOption('viewer', browseURL)
if (is.function(open)) open(url)
invisible(url)
}
Expand Down

0 comments on commit 7b6ec53

Please sign in to comment.