diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-12-16 20:17:21 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-12-16 20:17:21 +0100 |
commit | ad6b738ed89069deec5eb2d0fb83668bdee08714 (patch) | |
tree | 0c9ca0b6aa3f831966dfa3c4306ecb3f22fc276b /src/libutil/tarfile.cc | |
parent | 4947e0a91aeefd898e5b976733e70f1fbc1c0ae7 (diff) | |
parent | 410acd29c046ae7296d882ee4750441d4ff29955 (diff) |
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/libutil/tarfile.cc')
-rw-r--r-- | src/libutil/tarfile.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc index 262bc655f..1be0ba24c 100644 --- a/src/libutil/tarfile.cc +++ b/src/libutil/tarfile.cc @@ -3,7 +3,7 @@ extern "C" { rust::Result<std::tuple<>> * - unpack_tarfile(rust::Source source, rust::StringSlice dest_dir); + unpack_tarfile(rust::Source source, rust::StringSlice dest_dir, rust::Result<std::tuple<>> & out); } namespace nix { @@ -11,7 +11,9 @@ namespace nix { void unpackTarfile(Source & source, const Path & destDir) { rust::Source source2(source); - rust::CBox(unpack_tarfile(source2, destDir))->unwrap(); + rust::Result<std::tuple<>> res; + unpack_tarfile(source2, destDir, res); + res.unwrap(); } void unpackTarfile(const Path & tarFile, const Path & destDir, @@ -22,8 +24,8 @@ void unpackTarfile(const Path & tarFile, const Path & destDir, auto source = sinkToSource([&](Sink & sink) { // FIXME: look at first few bytes to determine compression type. auto decompressor = - // FIXME: add .gz support hasSuffix(*baseName, ".bz2") ? makeDecompressionSink("bzip2", sink) : + hasSuffix(*baseName, ".gz") ? makeDecompressionSink("gzip", sink) : hasSuffix(*baseName, ".xz") ? makeDecompressionSink("xz", sink) : makeDecompressionSink("none", sink); readFile(tarFile, *decompressor); |