Handle IFileSystem rename.

This commit is contained in:
Chris Ross 2015-01-20 08:37:10 -08:00
parent a93537e3be
commit 36c2a44b91
4 changed files with 7 additions and 7 deletions

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using Microsoft.AspNet.FileSystems;
using Microsoft.AspNet.FileProviders;
using Microsoft.Framework.Runtime;
namespace Microsoft.AspNet.Hosting
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Hosting
{
EnvironmentName = DefaultEnvironmentName;
WebRoot = HostingUtilities.GetWebRoot(appEnvironment.ApplicationBasePath);
WebRootFileSystem = new PhysicalFileSystem(WebRoot);
WebRootFileProvider = new PhysicalFileProvider(WebRoot);
foreach (var configure in configures)
{
configure.Configure(this);
@ -26,6 +26,6 @@ namespace Microsoft.AspNet.Hosting
public string WebRoot { get; private set; }
public IFileSystem WebRootFileSystem { get; set; }
public IFileProvider WebRootFileProvider { get; set; }
}
}

View File

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.FileSystems;
using Microsoft.AspNet.FileProviders;
using Microsoft.Framework.Runtime;
namespace Microsoft.AspNet.Hosting
@ -13,6 +13,6 @@ namespace Microsoft.AspNet.Hosting
string WebRoot { get; }
IFileSystem WebRootFileSystem { get; set; }
IFileProvider WebRootFileProvider { get; set; }
}
}

View File

@ -2,7 +2,7 @@
"version": "1.0.0-*",
"description": "ASP.NET 5 core hosting infrastructure and startup logic for web applications.",
"dependencies": {
"Microsoft.AspNet.FileSystems": "1.0.0-*",
"Microsoft.AspNet.FileProviders": "1.0.0-*",
"Microsoft.AspNet.Http.Core": "1.0.0-*",
"Microsoft.Framework.Logging": "1.0.0-*",
"Microsoft.Framework.OptionsModel": "1.0.0-*",

View File

@ -59,7 +59,7 @@ namespace Microsoft.AspNet.Hosting
var services = HostingServices.Create().BuildServiceProvider();
var env = services.GetRequiredService<IHostingEnvironment>();
Assert.Equal(Path.GetFullPath("testroot"), env.WebRoot);
Assert.True(env.WebRootFileSystem.GetFileInfo("TextFile.txt").Exists);
Assert.True(env.WebRootFileProvider.GetFileInfo("TextFile.txt").Exists);
}
public void Initialize(IApplicationBuilder builder)