mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-11-15 16:51:49 +00:00
Remove the extraction folder also after a failed extraction (#424)
* Remove the extraction folder also after a failed extraction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the original cleanup comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -405,11 +405,13 @@ namespace BinaryObjectScanner
|
||||
// If we're scanning archives
|
||||
if (_scanArchives && wrapper is IExtractable extractable)
|
||||
{
|
||||
// Get the output path
|
||||
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||
|
||||
// If the extractable file itself fails
|
||||
try
|
||||
{
|
||||
// Extract and get the output path
|
||||
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||
// Extract to the output path
|
||||
Directory.CreateDirectory(tempPath);
|
||||
_ = extractable.Extract(tempPath, _includeDebug);
|
||||
|
||||
@@ -426,7 +428,13 @@ namespace BinaryObjectScanner
|
||||
// Append the values
|
||||
protections.Append(subProtections);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_includeDebug) Console.Error.WriteLine(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// If temp directory cleanup fails
|
||||
try
|
||||
{
|
||||
@@ -438,10 +446,6 @@ namespace BinaryObjectScanner
|
||||
if (_includeDebug) Console.Error.WriteLine(ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_includeDebug) Console.Error.WriteLine(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user