Skip to content

Commit

Permalink
bugfix for linkOrCopy:�
Browse files Browse the repository at this point in the history
* linkOrCopy was not linking/copying multiple files because isTRUE/isFALSE cannot deal with vectors of length > 1
* this was causing issue #75 (comment)
  • Loading branch information
CeresBarros committed Nov 20, 2018
1 parent d54d7ee commit b06f7d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/preProcess.R
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ linkOrCopy <- function (from, to, symlink = TRUE) {

# Try hard link first -- the only type that R deeply recognizes
warns <- capture_warnings(result <- file.link(from[!dups], to))
if (isTRUE(result)) {
if (isTRUE(all(result))) {
message("Hardlinked version of file created at: ", to, ", which points to "
, from, "; no copy was made.")
}
Expand All @@ -743,17 +743,17 @@ linkOrCopy <- function (from, to, symlink = TRUE) {
}

# On *nix types -- try symlink
if (isFALSE(result) && isTRUE(symlink)) {
if (isFALSE(all(result)) && isTRUE(symlink)) {
if (!identical(.Platform$OS.type, "windows")) {
result <- suppressWarnings(file.symlink(from, to))
if (isTRUE(result)) {
if (isTRUE(all(result))) {
message("Symlinked version of file created at: ", to, ", which points to "
, from, "; no copy was made.")
}
}
}

if (isFALSE(result)) {
if (isFALSE(all(result))) {
result <- file.copy(from, to)
message("Copy of file: ", from, ", was created at: ", to)
}
Expand Down

0 comments on commit b06f7d5

Please sign in to comment.