diff --git a/R/reprex-undo.R b/R/reprex-undo.R index 256434f5..f2725ac3 100644 --- a/R/reprex-undo.R +++ b/R/reprex-undo.R @@ -145,6 +145,7 @@ reprex_undo <- function(input = NULL, ) r_file <- r_file_clean(undo_files$filebase) if (would_clobber(r_file)) { + reprex_warning("Cancelling to avoid overwriting a file.") return(invisible()) } diff --git a/R/reprex_impl.R b/R/reprex_impl.R index e41a698a..81e677a3 100644 --- a/R/reprex_impl.R +++ b/R/reprex_impl.R @@ -63,6 +63,7 @@ reprex_impl <- function(x_expr = NULL, r_file <- r_file(reprex_files$filebase) if (would_clobber(r_file)) { + reprex_warning("Cancelling to avoid overwriting a file.") return(invisible()) } diff --git a/R/utils-io.R b/R/utils-io.R index 0c23060b..1955aabd 100644 --- a/R/utils-io.R +++ b/R/utils-io.R @@ -240,10 +240,10 @@ would_clobber <- function(path) { if (!file_exists(path)) { return(FALSE) } + reprex_path("Oops, file already exists:", path, type = "warning") if (!is_interactive()) { return(TRUE) } - reprex_path("Oops, file already exists:", path, type = "warning") nope("Carry on and overwrite it?") }