public void Execute(string directoryPath) { directoryPath = FileSystemHelpers.EnsureFullPath(directoryPath); if (!Directory.Exists(directoryPath)) { throw new DirectoryNotFoundException($"Directory not found: {directoryPath}"); } ExecuteDirectory(directoryPath); }
public static bool TryEnsureFullPath(string path, [NotNullWhen(true)] out string?fullPath) { try { fullPath = FileSystemHelpers.EnsureFullPath(path); return(true); } catch (ArgumentException ex) { WriteError($"Path '{path}' is invalid: {ex.Message}."); fullPath = null; return(false); } }