R/path.R

Defines functions path_fix

Documented in path_fix

#' Fix backslashes in a windows file path on your clipboard
#'
#' Shift + Right-click in the Windows file Explorer allows you to copy a file
#' path, but it has backslashes. With this function, you get the forward
#' slash version in your clipboard, so it can be used inside your R code.
#'
#' @export
path_fix <- function() {
  path <- readClipboard() %>%
    gsub("\\\\", "/", .)
  path %>%
    writeClipboard()
  rui::approve("Your path has forward slashes now:")
  rui::inform("{.path {path}}")
  invisible()
}
rogiersbart/br documentation built on Jan. 3, 2021, 10:33 a.m.