`requireWebshot2`: use `Sys.which` instead of `file.exists`?
stla opened this issue · 3 comments
Hello,
The function requireWebshot2
is:
requireWebshot2 <- function() {
suppressMessages(res <- requireNamespace("webshot2", quietly = TRUE))
if (res)
res <- requireNamespace("chromote") &&
!is.null(path <- chromote::find_chrome()) &&
nchar(path) > 0 &&
file.exists(path)
res
}
However chromote::find_chrome()
returns chrome
for me, which is in the system path. Instead of file.exists(path)
, which returns FALSE
for me, can't we use nchar(Sys.which(path)) > 0
?
Now I confess I didn't seriously study this question.
- rgl Version: 1.1.3
- R Version: 4.3.1
- Platform: Windows 10
The chromote::find_chrome
function is documented to return a path. Looking at the source, I see it starts with
if (Sys.getenv("CHROMOTE_CHROME") != "") {
return(Sys.getenv("CHROMOTE_CHROME"))
}
so it's not checking if you have the location set to something else. So this is an error on your system, or in the chromote
docs, but it seems worthwhile to work around it as you suggest.
Ah yes sorry, actually that's me who defined Sys.setenv(CHROMOTE_CHROME = "chrome")
.
I think this should be dealt with by chromote
rather than rgl
, so I'm closing this issue.