You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/Recyclarr.Common/JsonUtils.cs

21 lines
563 B

using System.IO.Abstractions;
using Recyclarr.Common.Extensions;
using Serilog;
namespace Recyclarr.Common;
public static class JsonUtils
{
public static IEnumerable<IFileInfo> GetJsonFilesInDirectories(IEnumerable<IDirectoryInfo?> dirs, ILogger log)
{
var dirsThatExist = dirs.NotNull().ToLookup(x => x.Exists);
foreach (var dir in dirsThatExist[false])
{
log.Debug("Specified metadata path does not exist: {Path}", dir);
}
return dirsThatExist[true].SelectMany(x => x.GetFiles("*.json"));
}
}