Fixed some bad test cases that really messed up my codebase.

This commit is contained in:
Joseph Milazzo 2021-03-22 16:02:07 -05:00
parent b66c6b5714
commit 585e965a85
11 changed files with 97 additions and 93 deletions

View file

@ -71,7 +71,12 @@ namespace API.Services
return !Directory.Exists(path) ? Array.Empty<string>() : Directory.GetFiles(path);
}
public bool ExistOrCreate(string directoryPath)
/// <summary>
/// Returns true if the path exists and is a directory. If path does not exist, this will create it. Returns false in all fail cases.
/// </summary>
/// <param name="directoryPath"></param>
/// <returns></returns>
public static bool ExistOrCreate(string directoryPath)
{
var di = new DirectoryInfo(directoryPath);
if (di.Exists) return true;
@ -81,7 +86,6 @@ namespace API.Services
}
catch (Exception ex)
{
_logger.LogError(ex, "There was an issue creating directory: {Directory}", directoryPath);
return false;
}
return true;