mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Do not use a "whole device" when there are partitions in extract files and ls. Fixes #262.
This commit is contained in:
@@ -303,67 +303,6 @@ namespace Aaru.Commands.Filesystem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var wholePart = new Partition
|
||||
{
|
||||
Name = "Whole device", Length = imageFormat.Info.Sectors,
|
||||
Size = imageFormat.Info.Sectors * imageFormat.Info.SectorSize
|
||||
};
|
||||
|
||||
Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart);
|
||||
|
||||
if(idPlugins.Count == 0)
|
||||
AaruConsole.WriteLine("Filesystem not identified");
|
||||
else if(idPlugins.Count > 1)
|
||||
{
|
||||
AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins");
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
if(plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out plugin))
|
||||
{
|
||||
AaruConsole.WriteLine($"As identified by {plugin.Name}.");
|
||||
|
||||
var fs = (IReadOnlyFilesystem)plugin.
|
||||
GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
|
||||
{});
|
||||
|
||||
error = fs.Mount(imageFormat, wholePart, encodingClass, parsedOptions, @namespace);
|
||||
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName) ? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs);
|
||||
|
||||
Statistics.AddFilesystem(fs.XmlFsType.Type);
|
||||
}
|
||||
else
|
||||
AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out plugin);
|
||||
AaruConsole.WriteLine($"Identified by {plugin.Name}.");
|
||||
|
||||
var fs = (IReadOnlyFilesystem)plugin.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
|
||||
{});
|
||||
|
||||
error = fs.Mount(imageFormat, wholePart, encodingClass, parsedOptions, @namespace);
|
||||
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName) ? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs);
|
||||
|
||||
Statistics.AddFilesystem(fs.XmlFsType.Type);
|
||||
}
|
||||
else
|
||||
AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
@@ -279,72 +279,6 @@ namespace Aaru.Commands.Filesystem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var wholePart = new Partition
|
||||
{
|
||||
Name = "Whole device", Length = imageFormat.Info.Sectors,
|
||||
Size = imageFormat.Info.Sectors * imageFormat.Info.SectorSize
|
||||
};
|
||||
|
||||
Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart);
|
||||
|
||||
if(idPlugins.Count == 0)
|
||||
AaruConsole.WriteLine("Filesystem not identified");
|
||||
else if(idPlugins.Count > 1)
|
||||
{
|
||||
AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins");
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
if(plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out plugin))
|
||||
{
|
||||
AaruConsole.WriteLine($"As identified by {plugin.Name}.");
|
||||
|
||||
var fs = (IReadOnlyFilesystem)plugin.
|
||||
GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
|
||||
{});
|
||||
|
||||
if(fs == null)
|
||||
continue;
|
||||
|
||||
error = fs.Mount(imageFormat, wholePart, encodingClass, parsedOptions, @namespace);
|
||||
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
ListFilesInDir("/", fs, longFormat);
|
||||
|
||||
Statistics.AddFilesystem(fs.XmlFsType.Type);
|
||||
}
|
||||
else
|
||||
AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out plugin);
|
||||
|
||||
if(plugin != null)
|
||||
{
|
||||
AaruConsole.WriteLine($"Identified by {plugin.Name}.");
|
||||
|
||||
var fs = (IReadOnlyFilesystem)plugin.
|
||||
GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[]
|
||||
{});
|
||||
|
||||
if(fs != null)
|
||||
{
|
||||
error = fs.Mount(imageFormat, wholePart, encodingClass, parsedOptions, @namespace);
|
||||
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
ListFilesInDir("/", fs, longFormat);
|
||||
|
||||
Statistics.AddFilesystem(fs.XmlFsType.Type);
|
||||
}
|
||||
else
|
||||
AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user