Skip to content

Commit

Permalink
only move _files/_cache dirs that have corresponding Rmd files
Browse files Browse the repository at this point in the history
this should fix the problem reported at #1307 (comment), in which case config_files was moved by mistake
  • Loading branch information
yihui committed Oct 27, 2023
1 parent a0ef873 commit cedaac9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bookdown
Type: Package
Title: Authoring Books and Technical Documents with R Markdown
Version: 0.36.1
Version: 0.36.2
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
person("Christophe", "Dervieux", , "[email protected]", role = c("ctb"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- Custom config files passed to the `config_file` argument of `render_book()` are no longer temporarily renamed to `_bookdown.yml` (thanks, @debruine, #1307).

- Do not move all `_files` directories temporarily to the `_bookdown_files` directory when calling `render_book()` (thanks, @steeleb, #1307).

# CHANGES IN bookdown VERSION 0.36

- Fix an issue with parsing resources from raw HTML code (thanks, @lennylin, https://community.rstudio.com/t/bookdown-image-with-a-weblink/172542)
Expand Down
5 changes: 4 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,11 @@ base64_css = function(css, exts = 'png', overwrite = FALSE) {

files_cache_dirs = function(dir = '.') {
if (!dir_exists(dir)) return(character())
out = list.files(dir, '_(files|cache)$', full.names = TRUE)
r = '_(files|cache)$'
out = list.files(dir, r, full.names = TRUE)
out = out[dir_exists(out)]
# only use dirs that have corresponding Rmd files
if (dir == '.') out = out[file.exists(sub(r, '.Rmd', out))]
out = out[basename(out) != '_bookdown_files']
out
}
Expand Down

0 comments on commit cedaac9

Please sign in to comment.