-
-
Notifications
You must be signed in to change notification settings - Fork 978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
output_file
relative path causes render
function fatal error in Windows
#2464
Comments
First, Thanks for the typo finding ! Regarding your main issue here, I believe this is directly related to #2370 See my answer there #2370 (comment) about |
Thanks! However, I think not only the documentation, but the code may need some modifications. Because besides issue #2370 , adjusting its behavior in Windows is also important. Also, it's quite redundant that the function uses both |
Are you refering to this that needs fixing ? > dir.create("dummy/examples", recursive = TRUE)
> rmarkdown:::dir_exists("dummy/examples")
[1] TRUE
> unlink("dummy", recursive = TRUE) In your example, if (!is.null(output_dir)) {
if (!dir_exists(output_dir))
dir.create(output_dir, recursive = TRUE)
output_dir <- normalize_path(output_dir)
} What exactly do you think the issue is ?
Maybe, but this will not change. Paths handling is quite complicated already - We tried to explained in the doc of argugments https://rmarkdown.rstudio.com/docs/reference/render.html
|
I now understand, I previously believe the issue is that windows backslash is not recognized. Now I find the actual reason: the |
Yes this is #2370 we'll do that. Thanks ! |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
In the Windows system, assume there is an R markdown file
lab_1/main.Rmd
relative to your working directory. Write anything in it. Then, run these codes in the R command line (in your working directory):It says
Error: The directory 'lab_1' does not not exist.
(The error message has two "not", it's not my typo, and you can address the line causing the problem easily).My debug attempt is shown as follows. In Lines 54-57 of
render
function:If
output_dir
is the default valuenull
, it doesn't cause any problem. But if we assign a relative path tooutput_dir
, thenormalize_path
will convert it to something like this:In Lines 153-155:
The
dir_exists
function returnsFALSE
for any path which uses slash in Windows, whereasdir_exists
thinks a path should use backslash!The session information:
Checklist
When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:
formatted your issue so it is easier for us to read?
included a minimal, self-contained, and reproducible example?
pasted the output from
xfun::session_info('rmarkdown')
in your issue?upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
installed and tested your bug with the development version of the rmarkdown package using
remotes::install_github("rstudio/rmarkdown")
?The text was updated successfully, but these errors were encountered: