diff --git a/R/install.R b/R/install.R index 6ae38936..7a8d5a7c 100644 --- a/R/install.R +++ b/R/install.R @@ -323,6 +323,11 @@ load_pkg_description <- function(path) { stop("No description at ", path_desc, call. = FALSE) } + # Check description is not empty + if (file.info(path_desc)$size == 0){ + stop("Description filie is empty at ", path_desc, call. = FALSE) + } + desc <- as.list(readDcf(path_desc)[1, ]) names(desc) <- tolower(names(desc)) desc$path <- path diff --git a/R/restore.R b/R/restore.R index 1c2382b2..646bc612 100644 --- a/R/restore.R +++ b/R/restore.R @@ -292,13 +292,19 @@ getSourceForPkgRecord <- function(pkgRecord, # headers"); hide those suppressWarnings(untar(srczip, exdir = scratchDir, tar = "internal")) # Find the base directory - basedir <- if (length(dir(scratchDir)) == 1) - file.path(scratchDir, dir(scratchDir)) - else - scratchDir + if (length(dir(scratchDir)) == 1){ + basedir <- file.path(scratchDir, dir(scratchDir)) + } else { + basedir <- scratchDir + } + print("All about that base!") + print(basedir) - if (!is.null(pkgRecord$gh_subdir)) + if (!is.null(pkgRecord$gh_subdir) && !identical(pkgRecord$gh_subdir, character(0))) basedir <- file.path(basedir, pkgRecord$gh_subdir) + print(pkgRecord) + print(basedir) + print(list.files(basedir)) if (!file.exists(file.path(basedir, 'DESCRIPTION'))) { stop('No DESCRIPTION file was found in the archive for ', pkgRecord$name)