r-lib / archive
Showing 2 of 4 files from the diff.

@@ -46,7 +46,7 @@
Loading
46 46
  }
47 47
  options <- validate_options(options)
48 48
49 -
  archive_extract_(archive, files, as.integer(strip_components), options, sz = 2^14)
49 +
  files <- archive_extract_(archive, files, as.integer(strip_components), options, sz = 2^14)
50 50
51 -
  invisible()
51 +
  invisible(files)
52 52
}

@@ -93,7 +93,7 @@
Loading
93 93
  }
94 94
}
95 95
96 -
[[cpp11::register]] void archive_extract_(
96 +
[[cpp11::register]] cpp11::strings archive_extract_(
97 97
    const cpp11::sexp& connection,
98 98
    cpp11::sexp file,
99 99
    int num_strip_components,
@@ -160,6 +160,8 @@
Loading
160 160
161 161
  size_t num_extracted = 0;
162 162
163 +
  cpp11::writable::strings extracted_files;
164 +
163 165
  for (R_xlen_t index = 1;; ++index) {
164 166
    res = call(archive_read_next_header, a, &entry);
165 167
    if (res == ARCHIVE_EOF) {
@@ -172,14 +174,17 @@
Loading
172 174
      if (filename == nullptr) {
173 175
        continue;
174 176
      }
175 -
      if (filename != original_filename) {
176 -
        archive_entry_copy_pathname(entry, filename);
177 -
      }
178 177
    }
179 178
180 179
    if (file == R_NilValue ||
181 180
        (!file_indexes.empty() && any_matches(index, file_indexes)) ||
182 181
        (!file_names.empty() && any_matches(filename, file_names))) {
182 +
      extracted_files.push_back(filename);
183 +
184 +
      if (filename != original_filename) {
185 +
        archive_entry_copy_pathname(entry, filename);
186 +
      }
187 +
183 188
      call(archive_write_header, ext, entry);
184 189
      copy_data(a, ext, progress_bar, total_read, num_extracted);
185 190
      call(archive_write_finish_entry, ext);
@@ -194,4 +199,6 @@
Loading
194 199
  call(archive_read_free, a);
195 200
  call(archive_write_close, ext);
196 201
  call(archive_write_free, ext);
202 +
203 +
  return extracted_files;
197 204
}
Files Coverage
R 75.00%
src 91.13%
Project Totals (19 files) 87.24%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
        informational: true
10
    patch:
11
      default:
12
        target: auto
13
        threshold: 1%
14
        informational: true
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading