Skip to content

Commit d866ca2

Browse files
authored
Don't try to browse local folder on RStudio server (#213)
1 parent 8a7763f commit d866ca2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

R/course.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,10 @@ tidy_unzip <- function(zipfile) {
232232
unlink(zipfile)
233233
}
234234

235-
done("Opening ", value(target), " in the file manager")
236-
utils::browseURL(normalizePath(target))
235+
if (!in_rstudio_server()) {
236+
done("Opening ", value(target), " in the file manager")
237+
utils::browseURL(normalizePath(target))
238+
}
237239
}
238240

239241
invisible(target)

R/rstudio.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ in_rstudio <- function(base_path = proj_get()) {
104104
normalizePath(proj) == normalizePath(base_path)
105105
}
106106

107+
in_rstudio_server <- function() {
108+
if (!rstudioapi::isAvailable()) {
109+
return(FALSE)
110+
}
111+
identical(rstudioapi::versionInfo()$mode, "server")
112+
}
113+
107114
parse_rproj <- function(file) {
108115
lines <- as.list(readLines(file))
109116
has_colon <- grepl(":", lines)

0 commit comments

Comments
 (0)