Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions R/restore.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down