Skip to content

[Feature request] Can Quarto please create_all_ temporary files _not_ in the same directory with my source files? #1666

Open
@ForceBru

Description

@ForceBru

What?

I'd like Quarto to create all temporary/intermediate files in the given subdirectory of the project root (or /tmp, or another user-provided directory). By "intermediate files" I mean all files that Quarto manages itself: .aux, .tex, .log, the intermediate .pdf, the .md generated from the .qmd and so on.

I'd like to write something like this in the frontmatter:

project:
  output-temp-dir: temporary_files
  output-dir: out

This would make Quarto write stuff only to output-dir and output-temp-dir and nowhere else. Currently, like knitr/bookdown/Rmarkdown, Quarto will write temporary files to the current directory.

Why?

  1. I created a Quarto project with the default file report.qmd (Quarto markdown).
  2. I tried editing it in RStudio but didn't like it, so I exited RStudio without closing the file.
  3. I switched to Zettlr, but it couldn't see the file, so I renamed it to report.md (regular Markdown). Now it worked and I continued working on report.md for a week in Zettlr.
  4. Rendering the file with quarto render --to pdf worked great. I simply had to put project: render: report.md in _quarto.yml.
  5. Today I started RStudio and apparently saved report.qmd (Quarto markdown!), so that it appeared in my project. Now I had both report.md with a week's worth of work and the almost empty report.qmd. For whatever reason (again, probably RStudio re-saved the old version of _quarto.yml too) the line project: render: report.md got changed to .qmd.
  6. I finally finished my work on report.md and rendered it: quarto render --to pdf.
  7. report.md was GONE and report.pdf contained whatever nonsense report.qmd had.
  8. I attempted to recover report.md with various tools, but to no avail.

It looks like in the process of analyzing report.qmd, Quarto deleted the "old" report.md, created a new report.md with the processed contents of report.qmd, merrily created the PDF from that MD file and then deleted report.md as an artefact of processing report.qmd.

Now all my work is gone, and it's kinda my fault because I named my file report.md and had a report.qmd alongside it. Also, I could've easily used version control, but deliberately chose not to since I was too lazy to set it up. Which turned out to be a stupid decision. It's also Quarto's fault: it could've looked at the modification dates, wondered why the "temporary" file report.md is much newer than the "original" report.qmd and asked me for permission to overwrite report.md.


I would like Quarto (and knitr/bookdown/RMarkdown/whatever) to do its processing and creating temporary files in /tmp, because that's where temporary files are supposed to go. Or in output-temp-dir: temporary_files, as suggested earlier, so that the user can control where the temporary files are going. But not in my working directory, where it can overwrite any important .md file I spent a week working on.

That would solve all such problems: I write my MD files in my project's directory, Quarto copies everything to /tmp/whatevergibberish, processes it and puts the output into output-dir. If the project's settings (or the frontmatter) require to save the .tex file, then copy it into the output directory as well. This way, the user doesn't have to worry about the processing done by Quarto. They also don't need to worry about Quarto overwriting their .md files.

Also, all output only goes to output-dir and Quarto never ever writes to the directory with the user's source files or any other directory besides those marked as output-: output-temp-dir and output-dir.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfilesIssues related to temporary file locations, nonstandard output locations, etc

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions