-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswap_project_paths.R
39 lines (22 loc) · 1.12 KB
/
swap_project_paths.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#' Take list of dependency file data and changes the project path
#' @param list.deps list of dependency file data
#' @param new.path file path for the new project path
#' @details Used with swapping branches by rework.project.path()
#' @return Updated list of dependency data
#' @export
#'
swap.project.paths <- function(list.deps,new.path=get.project.path(source_info$project.id)){
# list.deps = list of dependency output files
old.project.path <- list.deps[[1]]$project.path[1]
shaved.variables <- c("path","source.file.path","target.path","project.path")
for(i in 1:length(list.deps)){
for(char.shave in shaved.variables){
for(file.iter in 1:nrow(list.deps[[i]])){
old.project.path <- list.deps[[i]]$project.path[file.iter]
list.deps[[i]][[char.shave]][file.iter] <- gsub(old.project.path,"",list.deps[[i]][[char.shave]][file.iter],fixed=TRUE)
list.deps[[i]][[char.shave]][file.iter] <- paste0(new.path,list.deps[[i]][[char.shave]][file.iter])
}
}
}
return(list.deps)
}# END: swap.project.paths