Skip to content

Commit

Permalink
add missing verifyAvailable calls
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinushey committed Oct 22, 2024
1 parent 2624044 commit d9bcd00
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: rstudioapi
Title: Safely Access the RStudio API
Description: Access the RStudio API (if available) and provide informative error
messages when it's not.
Version: 0.17.0.9000
Version: 0.17.1
Authors@R: c(
person("Kevin", "Ushey", role = c("aut", "cre"), email = "[email protected]"),
person("JJ", "Allaire", role = c("aut"), email = "[email protected]"),
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# rstudioapi (development version)
# rstudioapi 0.17.1

* Ensure a more appropriate error message is emitted for calls to
`rstudioapi::getVersion()` and `rstudioapi::getMode()` outside
of RStudio.


# rstudioapi 0.17.0
Expand Down
2 changes: 2 additions & 0 deletions R/code.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ getVersion <- function() {
return(callFun("getVersion"))

# use fallback if not
verifyAvailable()
base <- .BaseNamespaceEnv
version <- base$.Call("rs_rstudioVersion", PACKAGE = "(embedding)")
package_version(version)
Expand All @@ -87,6 +88,7 @@ getMode <- function() {
return(callFun("getMode"))

# use fallback if not
verifyAvailable()
rstudio <- as.environment("tools:rstudio")
if (rstudio$.rs.isDesktop()) "desktop" else "server"

Expand Down

0 comments on commit d9bcd00

Please sign in to comment.