|
|
|
@ -5,9 +5,11 @@ using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.FileProviders; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Microsoft.Extensions.FileProviders; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Mvc.Libs; |
|
|
|
@ -34,7 +36,7 @@ public class AbpMvcLibsService : IAbpMvcLibsService, ITransientDependency |
|
|
|
" <title>ABP MVC Libs Error</title>" + |
|
|
|
" </head>" + |
|
|
|
" <body>" + |
|
|
|
" <h1>ABP MVC Libs folder is not found!</h1>" + |
|
|
|
" <h1>ABP MVC Libs folder(wwwroot/libs) does not exist or empty!</h1>" + |
|
|
|
" <p>Please make sure you have run the <b>abp install-libs</b> command.</p>" + |
|
|
|
" <p>For more information, see <a href='https://abp.io/docs/latest/CLI#install-libs'>CLI install-libs</a> document.</p>" + |
|
|
|
" </body>" + |
|
|
|
@ -61,13 +63,14 @@ public class AbpMvcLibsService : IAbpMvcLibsService, ITransientDependency |
|
|
|
|
|
|
|
protected virtual Task<bool> HandleCheckLibsAsync(HttpContext httpContext) |
|
|
|
{ |
|
|
|
var fileProvider = httpContext.RequestServices.GetRequiredService<IWebHostEnvironment>().WebRootFileProvider; |
|
|
|
var abpFiles = new IFileInfo[] |
|
|
|
var fileProvider = new PhysicalFileProvider(httpContext.RequestServices.GetRequiredService<IWebHostEnvironment>().WebRootPath); |
|
|
|
var libsFolder = fileProvider.GetDirectoryContents("/libs"); |
|
|
|
if (!libsFolder.Exists || !libsFolder.Any()) |
|
|
|
{ |
|
|
|
fileProvider.GetFileInfo("/libs/abp/core/abp.js"), |
|
|
|
fileProvider.GetFileInfo("/libs/abp/core/abp.css") |
|
|
|
}; |
|
|
|
|
|
|
|
return Task.FromResult(abpFiles.All(abpFile => abpFile.Exists)); |
|
|
|
var logger = httpContext.RequestServices.GetRequiredService<ILogger<AbpMvcLibsService>>(); |
|
|
|
logger.LogError("The 'wwwroot/libs' folder does not exist or empty!"); |
|
|
|
return Task.FromResult(false); |
|
|
|
} |
|
|
|
return Task.FromResult(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|