mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-23 15:34:34 +00:00
added home dir and unknown entry
This commit is contained in:
@@ -42,7 +42,12 @@ public sealed class ArchiveInspector
|
||||
throw new ArgumentException("Archive path is required.", nameof(archivePath));
|
||||
}
|
||||
|
||||
var fileInfo = new FileInfo(archivePath);
|
||||
// Handle tilde expansion for home directory, then convert relative paths to absolute paths
|
||||
var expandedPath = archivePath.StartsWith('~')
|
||||
? archivePath.Replace("~", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), StringComparison.Ordinal)
|
||||
: archivePath;
|
||||
var fullPath = Path.GetFullPath(expandedPath);
|
||||
var fileInfo = new FileInfo(fullPath);
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
throw new FileNotFoundException($"Archive file was not found: {fileInfo.FullName}");
|
||||
|
||||
@@ -108,7 +108,11 @@ internal class SevenZipFilePart : FilePart
|
||||
return CompressionType.None;
|
||||
}
|
||||
|
||||
var coder = Folder.NotNull()._coders.First();
|
||||
var coder = Folder?._coders.FirstOrDefault();
|
||||
if (coder == null)
|
||||
{
|
||||
return CompressionType.Unknown;
|
||||
}
|
||||
return coder._methodId._id switch
|
||||
{
|
||||
K_COPY => CompressionType.None,
|
||||
|
||||
Reference in New Issue
Block a user