Verbose logging and empty strings

This commit is contained in:
Matt Nadareski
2020-08-17 14:10:53 -07:00
parent e50580f460
commit 6f5d959629

View File

@@ -71,6 +71,10 @@ namespace SabreTools.Library.IO
{
string input = inputs[i];
// If we have a null or empty path
if (string.IsNullOrEmpty(input))
continue;
// If we have a wildcard
string pattern = "*";
if (input.Contains("*") || input.Contains("?"))
@@ -79,11 +83,20 @@ namespace SabreTools.Library.IO
input = input.Substring(0, input.Length - pattern.Length);
}
// Get the parent path in case of appending
string parentPath;
try
{
parentPath = Path.GetFullPath(input);
}
catch (Exception ex)
{
Globals.Logger.Error($"An exception occurred getting the full path for '{input}': {ex}");
continue;
}
if (Directory.Exists(input))
{
// Get the parent path in case of appending
string parentPath = Path.GetFullPath(input);
List<string> directories = GetDirectoriesOrdered(input, pattern);
foreach (string dir in directories)
{
@@ -97,7 +110,7 @@ namespace SabreTools.Library.IO
}
catch (Exception ex)
{
Globals.Logger.Error(ex.ToString());
Globals.Logger.Error($"An exception occurred processing '{dir}': {ex}");
}
}
}
@@ -154,6 +167,10 @@ namespace SabreTools.Library.IO
{
string input = inputs[i];
// If we have a null or empty path
if (string.IsNullOrEmpty(input))
continue;
// If we have a wildcard
string pattern = "*";
if (input.Contains("*") || input.Contains("?"))