【发布时间】:2021-04-27 09:09:18
【问题描述】:
背景 -
我的整个bookdown 项目都在_source 目录中,我想在docs 的1-up 目录中拥有编译好的书。
完整路径是-"C:/Users/kbc/project1/docs/_source"
可行的解决方案 -
我可以通过使用 -output_dir: 'C:/Users/kbc/project1/docs'
_bookdown.yml 中的输出目录进行硬编码来做到这一点
问题 -
但是,我想通过使用 here::here() 来检索当前位置并使用 -output_dir: stringr::str_remove_all(here::here(), "/_source") 剥离最后一个 /_source 部分来灵活使用路径。
但构建失败并出现以下错误 -
Error in file(con, "w") : cannot open the connection
Calls: <Anonymous> ... write_ref_keys -> <Anonymous> -> writeLines -> file
In addition: There were 32 warnings (use warnings() to see them)
Execution halted
Exited with status 1.
为什么output_dir: 接受硬编码的字符数组,而不接受来自函数的字符数组?我可以为灵活方法做些什么?
【问题讨论】: