Skip to content

Commit

Permalink
fix: erroneous version comparison
Browse files Browse the repository at this point in the history
- fixes a comparison between strings to a comparison between
  a numeric_version and a string (a valid op).

- Uses getNamespaceVersion as clearer and part of base API as well
  as still being performant.
  • Loading branch information
TimTaylor committed Oct 17, 2024
1 parent f2aacb2 commit 9d72217
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions R/aab-rstudio-detect.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ rstudio <- local({
if (d$api) {
ns <- asNamespace("rstudioapi")
d$ver <- if (d$api) ns$getVersion()

# Pull version from namespace rather than via `utils::packageVersion()`
# to avoid slowdown (see https://github.com/r-lib/rlang/pull/1657 and
# https://github.com/r-lib/rlang/issues/1422)
new_api <- ns[[".__NAMESPACE__."]][["spec"]][["version"]] >= "0.17.0"
new_api <- getNamespaceVersion(ns) >= "0.17.0"
d$desktop <- if (new_api) ns$getMode() else ns$versionInfo()$mode
}

Expand Down

0 comments on commit 9d72217

Please sign in to comment.