Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

- Resources with URL encoded special characters are now correctly copied to the output directory (thanks, @AshesITR, #622).

- `serve_book()` can now be used without error when rstudioapi is installed but RStudio is not being used (thanks, @jimhester, #637).

# CHANGES IN bookdown VERSION 0.7

## MAJOR CHANGES
Expand Down
3 changes: 2 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ serve_book = function(
) {
# when this function is called via the RStudio addin, use the dir of the
# current active document
if (missing(dir) && requireNamespace('rstudioapi', quietly = TRUE)) {
if (missing(dir) && requireNamespace('rstudioapi', quietly = TRUE) &&
rstudioapi::isAvailable()) {
path = rstudioapi::getSourceEditorContext()[['path']]
if (!(is.null(path) || path == '')) dir = dirname(path)
}
Expand Down