From a8d065dc9eb7cca1165c7fc4b22b2b1bf4e2b579 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Sun, 12 Sep 2021 08:47:30 +0100 Subject: [PATCH 1/2] Ensure destination directory exists --- src/SharpCompress/Common/ExtractionMethods.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/SharpCompress/Common/ExtractionMethods.cs b/src/SharpCompress/Common/ExtractionMethods.cs index 738e3f398..8301bcebd 100644 --- a/src/SharpCompress/Common/ExtractionMethods.cs +++ b/src/SharpCompress/Common/ExtractionMethods.cs @@ -14,14 +14,25 @@ internal static class ExtractionMethods Action write) { string destinationFileName; - string file = Path.GetFileName(entry.Key); string fullDestinationDirectoryPath = Path.GetFullPath(destinationDirectory); + + //check for trailing slash. + if (fullDestinationDirectoryPath[fullDestinationDirectoryPath.Length - 1] != Path.DirectorySeparatorChar) + { + fullDestinationDirectoryPath += Path.DirectorySeparatorChar; + } + + if (!Directory.Exists(fullDestinationDirectoryPath)) + { + throw new ExtractionException($"Directory does not exist to extract to: {fullDestinationDirectoryPath}"); + } options ??= new ExtractionOptions() { Overwrite = true }; + string file = Path.GetFileName(entry.Key); if (options.ExtractFullPath) { string folder = Path.GetDirectoryName(entry.Key)!; From 0209d001641b3c7713e4cfe69c789d93b5f2580f Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Sun, 12 Sep 2021 08:52:00 +0100 Subject: [PATCH 2/2] Minor updates and prep for 0.29 --- .github/workflows/dotnetcore.yml | 2 +- build/build.csproj | 2 +- global.json | 3 ++- src/SharpCompress/SharpCompress.csproj | 8 ++++---- tests/SharpCompress.Test/SharpCompress.Test.csproj | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 874cb75e6..cbf2b6e22 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.300 + dotnet-version: 5.0.400 - run: dotnet run -p build/build.csproj - uses: actions/upload-artifact@v2 with: diff --git a/build/build.csproj b/build/build.csproj index 6fe449c5b..1f5e65c72 100644 --- a/build/build.csproj +++ b/build/build.csproj @@ -6,7 +6,7 @@ - + diff --git a/global.json b/global.json index 491689619..db3bce968 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,6 @@ { "sdk": { - "version": "5.0.300" + "version": "5.0.300", + "rollForward": "latestFeature" } } \ No newline at end of file diff --git a/src/SharpCompress/SharpCompress.csproj b/src/SharpCompress/SharpCompress.csproj index 550e4776d..77092183d 100644 --- a/src/SharpCompress/SharpCompress.csproj +++ b/src/SharpCompress/SharpCompress.csproj @@ -2,9 +2,9 @@ SharpCompress - Pure C# Decompression/Compression en-US - 0.28.3 - 0.28.3 - 0.28.3 + 0.29.0 + 0.29.0 + 0.29.0 Adam Hathcock netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0 true @@ -18,7 +18,7 @@ https://github.com/adamhathcock/sharpcompress/blob/master/LICENSE.txt false false - SharpCompress is a compression library for NET Standard 2.0/2.1//NET 4.6 that can unrar, decompress 7zip, decompress xz, zip/unzip, tar/untar lzip/unlzip, bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented. + SharpCompress is a compression library for NET Standard 2.0/2.1/NET 5.0 that can unrar, decompress 7zip, decompress xz, zip/unzip, tar/untar lzip/unlzip, bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented. 9 enable true diff --git a/tests/SharpCompress.Test/SharpCompress.Test.csproj b/tests/SharpCompress.Test/SharpCompress.Test.csproj index 6227e33e5..65dfd34d7 100644 --- a/tests/SharpCompress.Test/SharpCompress.Test.csproj +++ b/tests/SharpCompress.Test/SharpCompress.Test.csproj @@ -12,7 +12,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive