| 1 |
|
| 2 |
# check for problems in the project's private library (e.g. broken symlinks |
| 3 |
# to the cache or similar) |
| 4 |
renv_library_diagnose <- function(project, libpath) { |
| 5 |
|
| 6 |
children <- list.files(libpath, full.names = TRUE) |
| 7 |
if (empty(children)) |
| 8 |
return(TRUE) |
| 9 |
|
| 10 |
# if all symlinks are broken, assume the cache is missing or has been moved |
| 11 |
missing <- !file.exists(children) |
| 12 |
if (all(missing)) { |
| 13 |
msg <- lines( |
| 14 |
"The project library's symlinks to the cache are all broken.", |
| 15 |
"Has the cache been removed, or is it otherwise inaccessible?", |
| 16 |
paste("Cache root:", dQuote(renv_paths_cache()[[1L]])) |
| 17 |
) |
| 18 |
warning(msg, call. = FALSE) |
| 19 |
return(FALSE) |
| 20 |
} |
| 21 |
|
| 22 |
# if only some symlinks are broken, report to user |
| 23 |
if (any(missing)) { |
| 24 |
|
| 25 |
bulletin( |
| 26 |
"The following package(s) are missing entries in the cache:", |
| 27 |
basename(children[missing]), |
| 28 |
"These packages will need to be reinstalled." |
| 29 |
) |
| 30 |
|
| 31 |
return(FALSE) |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
TRUE |
| 36 |
|
| 37 |
} |