mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DATFromDir] Try to delete the copied file in more places
This commit is contained in:
@@ -244,6 +244,13 @@ namespace SabreTools
|
||||
if (type != null && !_archivesAsFiles)
|
||||
{
|
||||
List<Rom> extracted = FileTools.GetArchiveFileInfo(newItem, _logger);
|
||||
|
||||
// Cue to delete the file if it's a copy
|
||||
if (_copyFiles && item != newItem)
|
||||
{
|
||||
FileTools.DeleteDirectory(Path.GetDirectoryName(newItem));
|
||||
}
|
||||
|
||||
foreach (Rom rom in extracted)
|
||||
{
|
||||
ProcessFileHelper(newItem,
|
||||
@@ -256,6 +263,12 @@ namespace SabreTools
|
||||
else if (File.Exists(newItem))
|
||||
{
|
||||
ProcessFile(newItem, newBasePath, "");
|
||||
|
||||
// Cue to delete the file if it's a copy
|
||||
if (_copyFiles && item != newItem)
|
||||
{
|
||||
FileTools.DeleteDirectory(Path.GetDirectoryName(newItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Otherwise, attempt to extract the files to the temporary directory
|
||||
@@ -272,6 +285,12 @@ namespace SabreTools
|
||||
// If the file was an archive and was extracted successfully, check it
|
||||
if (!encounteredErrors)
|
||||
{
|
||||
// Cue to delete the file if it's a copy
|
||||
if (_copyFiles && item != newItem)
|
||||
{
|
||||
FileTools.DeleteDirectory(Path.GetDirectoryName(newItem));
|
||||
}
|
||||
|
||||
_logger.Log(Path.GetFileName(item) + " treated like an archive");
|
||||
List<string> extracted = Directory.EnumerateFiles(tempSubDir, "*", SearchOption.AllDirectories).ToList();
|
||||
Parallel.ForEach(extracted,
|
||||
@@ -290,13 +309,13 @@ namespace SabreTools
|
||||
else if (File.Exists(newItem))
|
||||
{
|
||||
ProcessFile(newItem, newBasePath, "");
|
||||
}
|
||||
}
|
||||
|
||||
// Cue to delete the file if it's a copy
|
||||
if (_copyFiles && item != newItem)
|
||||
{
|
||||
FileTools.DeleteFile(newItem);
|
||||
// Cue to delete the file if it's a copy
|
||||
if (_copyFiles && item != newItem)
|
||||
{
|
||||
FileTools.DeleteDirectory(Path.GetDirectoryName(newItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the sub temp directory
|
||||
|
||||
Reference in New Issue
Block a user