From 65fc83e4f550345021ad8a3aebbb522d2708c095 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 22 Sep 2016 14:21:12 -0700 Subject: [PATCH] Revert part of "[DATFromDir] Try to delete the copied file in more places" --- SabreTools.Helper/Objects/DATFromDir.cs | 30 +++++-------------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/SabreTools.Helper/Objects/DATFromDir.cs b/SabreTools.Helper/Objects/DATFromDir.cs index 6a057566..64e15b9d 100644 --- a/SabreTools.Helper/Objects/DATFromDir.cs +++ b/SabreTools.Helper/Objects/DATFromDir.cs @@ -245,12 +245,6 @@ namespace SabreTools { List 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, @@ -263,12 +257,6 @@ 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 @@ -285,12 +273,6 @@ 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 extracted = Directory.EnumerateFiles(tempSubDir, "*", SearchOption.AllDirectories).ToList(); Parallel.ForEach(extracted, @@ -309,15 +291,15 @@ 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)); - } } } + // Cue to delete the file if it's a copy + if (_copyFiles && item != newItem) + { + FileTools.DeleteFile(newItem); + } + // Delete the sub temp directory if (Directory.Exists(tempSubDir)) {