add filesystem for webroot
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
namespace zero.Media;
|
||||
|
||||
public class WebRootFileSystem : PhysicalFileSystem, IWebRootFileSystem
|
||||
{
|
||||
protected string PublicPathPrefix { get; }
|
||||
|
||||
|
||||
public WebRootFileSystem(string root, string publicPathPrefix) : base(root)
|
||||
{
|
||||
PublicPathPrefix = (publicPathPrefix ?? String.Empty).EnsureEndsWith('/');
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string MapToPublicPath(string path)
|
||||
{
|
||||
if (path.IsNullOrEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return PublicPathPrefix + path.TrimStart('/');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface IWebRootFileSystem : IFileSystem
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user