diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 874cb75e..cbf2b6e2 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 6fe449c5..1f5e65c7 100644 --- a/build/build.csproj +++ b/build/build.csproj @@ -6,7 +6,7 @@ - + diff --git a/global.json b/global.json index 49168961..db3bce96 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/Common/ExtractionMethods.cs b/src/SharpCompress/Common/ExtractionMethods.cs index 738e3f39..8301bceb 100644 --- a/src/SharpCompress/Common/ExtractionMethods.cs +++ b/src/SharpCompress/Common/ExtractionMethods.cs @@ -14,14 +14,25 @@ public static void WriteEntryToDirectory(IEntry entry, 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)!; diff --git a/src/SharpCompress/SharpCompress.csproj b/src/SharpCompress/SharpCompress.csproj index 550e4776..77092183 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 6227e33e..65dfd34d 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