-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* relative linking * no need for stilt_wd as parameter to link_files
- Loading branch information
Showing
3 changed files
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
#' link_files symlinks files in exe/* to the target path | ||
#' @author Ben Fasoli | ||
#' link_files symlinks files to the target path using relative paths | ||
#' @author Ben Fasoli & James Mineau | ||
#' | ||
#' @param from location of files | ||
#' @param to location to create links | ||
#' | ||
#' @export | ||
|
||
link_files <- function(from, to) { | ||
files <- dir(from, full.names = T) | ||
suppressWarnings(file.symlink(files, to)) | ||
require(R.utils) | ||
|
||
# # Get all files in `from` | ||
x <- lapply(from, list.files, full.names = T) | ||
is_file <- sapply(x, function(x) length(x) == 0) | ||
files <- c(from[is_file], unlist(x[!is_file])) | ||
|
||
# Convert to paths relative to stilt_wd | ||
relative_files <- R.utils::getRelativePath(files, to) | ||
|
||
# Create the links | ||
suppressWarnings(file.symlink(relative_files, to)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters