From 37d356beed7acfa23ade6ab973aa3d1d6665034f Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Fri, 29 Jul 2016 15:49:30 +0200 Subject: [PATCH] =?UTF-8?q?fixe=20le=20premier=20d=C3=A9marrage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yavsc/Startup/Startup.FileServer.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Yavsc/Startup/Startup.FileServer.cs b/Yavsc/Startup/Startup.FileServer.cs index 8f83ea40..b5f6db2a 100644 --- a/Yavsc/Startup/Startup.FileServer.cs +++ b/Yavsc/Startup/Startup.FileServer.cs @@ -14,16 +14,20 @@ namespace Yavsc public void ConfigureFileServerApp(IApplicationBuilder app, SiteSettings siteSettings, IHostingEnvironment env) { - app.UseFileServer(new FileServerOptions() - { - FileProvider = new PhysicalFileProvider( - Path.Combine( + var rootPath = Path.Combine( env.WebRootPath, // TODO: add a ressource serveur id here, // or remove the blog entry id usage, to use the userid instead // and an user defined optional subdir. siteSettings.UserFiles.DirName - )), + ); + var rootInfo = new DirectoryInfo(rootPath); + if (!rootInfo.Exists) rootInfo.Create(); + + + app.UseFileServer(new FileServerOptions() + { + FileProvider = new PhysicalFileProvider(rootPath), RequestPath = new PathString("/" + siteSettings.UserFiles.DirName), EnableDirectoryBrowsing = false });