Skip to content

Commit

Permalink
use different version of file.edit depending on context (closes tidyv…
Browse files Browse the repository at this point in the history
  • Loading branch information
crew102 committed Sep 17, 2018
1 parent 90e6dee commit f3f3a9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/reprex.R
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ reprex <- function(x = NULL,
" * ", reprex_file
)
if (yep("Open the output file for manual copy?")) {
withr::defer(utils::file.edit(reprex_file))
withr::defer(file_edit(reprex_file))
}
}

Expand Down
8 changes: 8 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,11 @@ collapse <- function(x, sep = "\n") {
backtick <- function(x) encodeString(x, quote = "`")

newline <- function(x) paste0(x, "\n")

file_edit <- function(...) {
if (exists("file.edit", envir = globalenv())) {
get("file.edit", envir = globalenv())(...)
} else {
utils::file.edit(...)
}
}

0 comments on commit f3f3a9d

Please sign in to comment.