Skip to content

--output-dir warns about non-empty directories, but deletes contents anyway #13623

@eheinzen

Description

@eheinzen

I have:

  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide

Bug description

I'm running quarto 1.8.24. When I specify --output-dir, it first warns about it not being an empty directory, but deletes files therein anyway:

Steps to reproduce

$ mkdir test_quarto
$ cd test_quarto
$ echo '---
> title: "Untitled"
> format: html
> ---' > test.qmd
$ mkdir important_files
$ echo 'Something important!' > important_files/do_not_delete.txt
$ quarto render test.qmd --output-dir important_files
ERROR: Directory not empty (os error 39): remove '<sensitive path>/test_quarto/.quarto'

Stack trace: <...>

$ cat important_files/do_not_delete.txt # It's not there!
cat: important_files/do_not_delete.txt: No such file or directory

However, it doesn't have this behavior with a _quarto.yml

$ mkdir test_quarto
$ cd test_quarto
$ echo '---
> title: "Untitled"
> format: html
> ---' > test.qmd
$ echo 'project:
>   output-dir: important_files' > _quarto.yml
$ mkdir important_files
$ echo 'Something important!' > important_files/do_not_delete.txt
$ quarto render test.qmd
  
Output created: important_files/test.html

$ cat important_files/do_not_delete.txt # It's there!
Something important!

Actual behavior

Deletes my files.

Expected behavior

Don't delete my files.

Your environment

Linux

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingprojects

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions