Skip to content

Commit

Permalink
clean up addPackage
Browse files Browse the repository at this point in the history
- improved messages when removing old versions
- only create dir structure if not already present
  • Loading branch information
achubaty committed Nov 18, 2014
1 parent 868eb65 commit 35cb2be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/addPackages.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ addPackage <- function(pkgs=NULL, path=NULL, repos=getOption("repos"),
curr <- checkVersions(pkgs=pkgs, path=path, type=type, Rversion=Rversion)
old <- intersect(prev, curr)
message("Removing previous versions of newly added packages:")
message(paste(basename(old), collapse=", "))
message(paste(basename(old), collapse="\n"))
file.remove(old)
}
if (writePACKAGES) {
Expand Down Expand Up @@ -224,7 +224,7 @@ addOldPackage <- function(pkgs=NULL, path=NULL, vers=NULL,
stop("path, pkgs, and vers must all be specified.")
}
if (type!="source") stop("Older binary versions are not normally available on CRAN. ",
"You must build the binary versions from source.")
"You must build the binary versions from source.")
if(deps) {
message("Unable to automatically determine dependency version information.")
message("Use `pkgs` and `vers` to identify which dependecies and there versions to download.")
Expand All @@ -234,7 +234,7 @@ addOldPackage <- function(pkgs=NULL, path=NULL, vers=NULL,
pkgs, sprintf("%s_%s%s", pkgs, vers, pkgFileExt(type)))

pkgPath <- file.path(path=path, repoPrefix(type, R.version))
dir.create(pkgPath, recursive=TRUE)
if(!file.exists(pkgPath)) dir.create(pkgPath, recursive=TRUE)
sapply(oldPkgs, function(x) {
download.file(x, destfile=file.path(pkgPath, basename(x)))
})
Expand Down

0 comments on commit 35cb2be

Please sign in to comment.