|
1 | 1 | # File src/library/utils/R/windows/install.packages.R |
2 | 2 | # Part of the R package, https://www.R-project.org |
3 | 3 | # |
4 | | -# Copyright (C) 1995-2022 The R Core Team |
| 4 | +# Copyright (C) 1995-2025 The R Core Team |
5 | 5 | # |
6 | 6 | # This program is free software; you can redistribute it and/or modify |
7 | 7 | # it under the terms of the GNU General Public License as published by |
|
18 | 18 |
|
19 | 19 | ## Unexported helper |
20 | 20 | unpackPkgZip <- function(pkg, pkgname, lib, libs_only = FALSE, |
21 | | - lock = FALSE, quiet = FALSE, reuse_lockdir = FALSE) |
| 21 | + lock = FALSE, quiet = FALSE, reuse_lockdir = FALSE, |
| 22 | + name_from_dir = FALSE) |
22 | 23 | { |
23 | 24 | .zip.unpack <- function(zipname, dest) |
24 | 25 | { |
@@ -46,6 +47,12 @@ unpackPkgZip <- function(pkg, pkgname, lib, libs_only = FALSE, |
46 | 47 | on.exit(unlink(tmpDir, recursive=TRUE), add = TRUE) |
47 | 48 | res <- .zip.unpack(pkg, tmpDir) |
48 | 49 | setwd(tmpDir) |
| 50 | + if (name_from_dir) { |
| 51 | + pkgname <- dir(".") |
| 52 | + if (length(pkgname) != 1) |
| 53 | + stop(gettextf("cannot extract package from %s", sQuote(pkg)), |
| 54 | + domain = NA, call. = FALSE) |
| 55 | + } |
49 | 56 | res <- tools::checkMD5sums(pkgname, file.path(tmpDir, pkgname)) |
50 | 57 | if(!quiet && !is.na(res) && res) { |
51 | 58 | cat(gettextf("package %s successfully unpacked and MD5 sums checked\n", |
|
0 commit comments