pbs-assess / csasdown

:book: An R package for creating CSAS reports in PDF or Word format with R Markdown and bookdown
Other
47 stars 17 forks source link

Needs more warning or checks before deleting everything on your computer #246

Closed schckngs closed 9 months ago

schckngs commented 9 months ago

Hi csasdown folks! This is user error, but I figured I'd mention it here so this doesn't happen to someone else?

I downloaded and installed csasdown on my personal computer to test it out before using for a technical report. During the install there are a number of menus for updating packages, etc. As I haven't used it before I tried out csasdown::draft("techreport"), without being in a project.

Among the various menus where you can type "y" or other options for updating packages, it popped up with a menu asking whether or not I wanted to delete what was in my current folder. I was not paying close enough attention and said "yes" (following other menus where I had just typed the same thing) - it was in my home directory and deleted everything on my computer. Thank goodness this was not on my work computer or I could have lost all of my work in my default R directory. To prevent this happening to an unprepared, beginner or otherwise spaced out installer like myself, could you please add another option (e.g. "Are you sure?") or check that it is in some subdirectory of some kind?

Thanks, -Andrea

seananderson commented 9 months ago

Thanks for reporting this and very sorry you experienced that! This was added not too long ago, I think. For safety, I think we shouldn't have any automated deleting. We should just issue a warning and the option to continue with existing files or abort and delete files manually. This is related to this issue. We should make sure there are no other 'delete all files' commands left hanging around while we're at it fixing this.

seananderson commented 9 months ago

This should be fixed with this commit: https://github.com/pbs-assess/csasdown/commit/4b98bb911984a02c85bdc983bb9da5403a933c98

I don't see any remaining unlink() calls within draft(). Sorry about that again.