1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2025-03-03 10:17:17 +00:00
Sonarr/NzbDrone.Api/Frontend/LogFileMapper.cs
2013-07-28 16:13:14 -07:00

29 lines
No EOL
744 B
C#

using System.IO;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Api.Frontend
{
public class LogFileMapper : IMapHttpRequestsToDisk
{
private readonly IAppFolderInfo _appFolderInfo;
public LogFileMapper(IAppFolderInfo appFolderInfo)
{
_appFolderInfo = appFolderInfo;
}
public string Map(string resourceUrl)
{
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
path = Path.GetFileName(path);
return Path.Combine(_appFolderInfo.GetLogFolder(), path);
}
public bool CanHandle(string resourceUrl)
{
return resourceUrl.StartsWith("/log");
}
}
}