r-lib / archive

Compare afeb08f ... +40 ... 30eb4d6

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -14,7 +14,7 @@
Loading
14 14
15 15
  old <- setwd(dir)
16 16
  on.exit(setwd(old))
17 -
  files <- dir(dir, ..., recursive = recursive, full.names = full.names)
17 +
  files <- dir(".", ..., recursive = recursive, full.names = full.names)
18 18
19 19
  archive_write_files(archive, files, format = format, filter = filter, options = options)
20 20

@@ -1,5 +1,4 @@
Loading
1 1
.onLoad <- function(libname, pkgname) {
2 -
  loadNamespace("cli")
3 2
  lib_path <- system.file("lib", .Platform$r_arch, paste0("libconnection", .Platform$dynlib.ext), package = "archive")
4 3
  res <- dyn.load(lib_path)
5 4

@@ -48,7 +48,16 @@
Loading
48 48
  for (std::string file : files) {
49 49
    stat(file.c_str(), &st);
50 50
    entry = archive_entry_new();
51 +
#if defined(_WIN32) || (!defined(__GNUC__) && !defined(__clang__))
52 +
    // there are quite many CRT dialects and passing struct stat to 3rdparty library could be unstable.
53 +
    archive_entry_set_size(entry, st.st_size);
54 +
    archive_entry_set_mtime(entry, st.st_mtime, 0);
55 +
    archive_entry_set_ctime(entry, st.st_ctime, 0);
56 +
    archive_entry_set_atime(entry, st.st_atime, 0);
57 +
    archive_entry_set_mode(entry, st.st_mode); // seems required as not defaulting to S_IFREG.
58 +
#else
51 59
    archive_entry_copy_stat(entry, &st);
60 +
#endif
52 61
    archive_entry_set_pathname(entry, file.c_str());
53 62
    call(archive_write_header, a, entry);
54 63
    if ((fd = open(file.c_str(), O_RDONLY)) != -1) {
@@ -70,5 +79,7 @@
Loading
70 79
  }
71 80
  call(archive_write_free, a);
72 81
82 +
  cli_progress_done(progress_bar);
83 +
73 84
  return R_NilValue;
74 85
}

@@ -1,6 +1,7 @@
Loading
1 1
## usethis namespace: start
2 2
#' @useDynLib archive, .registration = TRUE
3 3
#' @importFrom tibble as_tibble
4 +
#' @importFrom cli cli_progress_bar
4 5
## usethis namespace: end
5 6
NULL
6 7
@@ -15,7 +16,7 @@
Loading
15 16
#' @seealso [archive_read()], [archive_write()] to read and write archive files
16 17
#' using R connections, [archive_extract()], [archive_write_files()],
17 18
#' [archive_write_dir()] to add or extract files from an archive.
18 -
#' @returns @return A [tibble][tibble::tibble-package] with details about files in the archive.
19 +
#' @return A [tibble][tibble::tibble-package] with details about files in the archive.
19 20
#' @examples
20 21
#' a <- archive(system.file(package = "archive", "extdata", "data.zip"))
21 22
#' a
@@ -156,3 +157,12 @@
Loading
156 157
  }
157 158
  package_version("0.0.0")
158 159
}
160 +
161 +
print_versions <- function(){
162 +
  cat("Linked to:\n")
163 +
  cat("libarchive", as.character(libarchive_version()), '\n')
164 +
  cat("zlib", as.character(libarchive_zlib_version()), '\n')
165 +
  cat("lzma", as.character(libarchive_liblzma_version()), '\n')
166 +
  cat("bzlib", as.character(libarchive_bzlib_version()), '\n')
167 +
  cat("zsstd", as.character(libarchive_libzstd_version()), '\n')
168 +
}

Learn more Showing 7 files with coverage changes found.

Changes in src/r_archive.h
-2
Loading file...
Changes in src/r_archive.cpp
-1
Loading file...
Changes in src/archive_extract.cpp
-1
Loading file...
Changes in src/archive_read.cpp
-1
Loading file...
Changes in R/zzz.R
+1
Loading file...
Changes in src/archive.cpp
-8
+6
Loading file...
Changes in R/archive.R
-8
+8
Loading file...

42 Commits

Hiding 2 contexual commits
Hiding 1 contexual commits Hiding 1 contexual commits
Hiding 1 contexual commits
+3
+19
-16
Hiding 1 contexual commits
-4
-4
Hiding 1 contexual commits Hiding 4 contexual commits
-1
-1
+2
+1
+1
Files Coverage
R +5.34% 80.34%
src +1.40% 92.51%
Project Totals (19 files) 89.47%
Loading