Skip to content

Commit

Permalink
fixes #874: create figure directories recursively for the engines tik…
Browse files Browse the repository at this point in the history
…z and dot
  • Loading branch information
yihui committed Oct 25, 2014
1 parent 4c641f8 commit 35e2925
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

- fixed #862: the YAML metadata in child R Markdown documents was not correctly removed (thanks, @krlmlr)

- fixed #874: for the engines `dot` and `tikz`, the figure directory will be created recursively (thanks, @WilDoane)

# CHANGES IN knitr VERSION 1.7

## NEW FEATURES
Expand Down
4 changes: 2 additions & 2 deletions R/engine.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ eng_tikz = function(options) {
unlink(texf)

fig = fig_path('', options)
dir.create(dirname(fig), showWarnings = FALSE)
dir.create(dirname(fig), recursive = TRUE, showWarnings = FALSE)
file.rename(outf, str_c(fig, '.pdf'))
# convert to the desired output-format, calling `convert`
ext = tolower(options$fig.ext %n% dev2ext(options$dev))
Expand Down Expand Up @@ -191,7 +191,7 @@ eng_dot = function(options) {
shQuote(str_c(fig <- fig_path(), '.', ext)))

# generate output
dir.create(dirname(fig), showWarnings = FALSE)
dir.create(dirname(fig), recursive = TRUE, showWarnings = FALSE)
outf = paste(fig, ext, sep = '.')
unlink(outf)
extra = if (options$eval) {
Expand Down

0 comments on commit 35e2925

Please sign in to comment.