added home dir and unknown entry

This commit is contained in:
Adam Hathcock
2026-02-21 17:45:09 +00:00
parent 718a034542
commit 2e77082c81
2 changed files with 11 additions and 2 deletions

View File

@@ -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}");

View File

@@ -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,