[DATFromDir] Put retry on intial delete too

This commit is contained in:
Matt Nadareski
2016-09-21 23:17:30 -07:00
parent 284c3e088e
commit 57f6d361f7
2 changed files with 15 additions and 5 deletions

View File

@@ -320,11 +320,19 @@ namespace SabreTools
// Cue to delete the file if it's a copy // Cue to delete the file if it's a copy
if (_copyFiles) if (_copyFiles)
{ {
try int i = 0;
while (File.Exists(newItem) && i < 50)
{ {
Directory.Delete(Path.GetDirectoryName(newItem), true); try
{
Directory.Delete(Path.GetDirectoryName(newItem), true);
}
catch
{
i++;
}
} }
catch if (File.Exists(newItem))
{ {
_clean.Add(newItem); _clean.Add(newItem);
} }

View File

@@ -441,11 +441,13 @@ namespace SabreTools.Helper
/// </summary> /// </summary>
public static int CompareNumeric(string s, string other) public static int CompareNumeric(string s, string other)
{ {
if ((s == null || s.Replace(" ", string.Empty).Length == 0) && (other != null && other.Replace(" ", string.Empty).Length > 0)) if ((s == null || s.Replace(" ", string.Empty).Length == 0)
&& (other != null && other.Replace(" ", string.Empty).Length > 0))
{ {
return -1; return -1;
} }
if ((s != null && s.Replace(" ", string.Empty).Length > 0) && (other == null || other.Replace(" ", string.Empty).Length == 0)) if ((s != null && s.Replace(" ", string.Empty).Length > 0)
&& (other == null || other.Replace(" ", string.Empty).Length == 0))
{ {
return 1; return 1;
} }