diff --git a/SabreTools.Helper/Tools/DatTools.cs b/SabreTools.Helper/Tools/DatTools.cs index 04b1443f..e1a52a67 100644 --- a/SabreTools.Helper/Tools/DatTools.cs +++ b/SabreTools.Helper/Tools/DatTools.cs @@ -1532,19 +1532,41 @@ namespace SabreTools.Helper // If we're in merging or diffing mode, use the full list of inputs if (merge || diff) { - // Create a new list of inputs that are only files + // Make sure there are no folders in inputs List newInputFileNames = new List(); foreach (string input in inputFileNames) { - if (File.Exists(input)) - { - newInputFileNames.Add(Path.GetFullPath(input)); - } - else if (Directory.Exists(input)) + if (Directory.Exists(input)) { foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories)) { - newInputFileNames.Add(Path.GetFullPath(file)); + try + { + newInputFileNames.Add(Path.GetFullPath(file) + "¬" + Path.GetFullPath(input)); + } + catch (PathTooLongException) + { + logger.Warning("The path for " + file + " was too long"); + } + catch (Exception ex) + { + logger.Error(ex.ToString()); + } + } + } + else if (File.Exists(input)) + { + try + { + newInputFileNames.Add(Path.GetFullPath(input) + "¬" + Path.GetDirectoryName(Path.GetFullPath(input))); + } + catch (PathTooLongException) + { + logger.Warning("The path for " + input + " was too long"); + } + catch (Exception ex) + { + logger.Error(ex.ToString()); } } }