Skip to content
This repository was archived by the owner on Nov 22, 2018. It is now read-only.

Commit 96835bd

Browse files
committed
Handle IFileSystem rename.
1 parent 60c3e7e commit 96835bd

14 files changed

+53
-53
lines changed

samples/StaticFileSample/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Microsoft.AspNet.Builder;
2-
using Microsoft.AspNet.FileSystems;
2+
using Microsoft.AspNet.FileProviders;
33
using Microsoft.AspNet.StaticFiles;
44
using Microsoft.Framework.Logging;
55
using Microsoft.Framework.Logging.Console;

src/Microsoft.AspNet.StaticFiles/DefaultFilesMiddleware.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class DefaultFilesMiddleware
2727
/// <param name="options">The configuration options for this middleware.</param>
2828
public DefaultFilesMiddleware([NotNull] RequestDelegate next, [NotNull] IHostingEnvironment hostingEnv, [NotNull] DefaultFilesOptions options)
2929
{
30-
options.ResolveFileSystem(hostingEnv);
30+
options.ResolveFileProvider(hostingEnv);
3131

3232
_next = next;
3333
_options = options;
@@ -47,14 +47,14 @@ public Task Invoke(HttpContext context)
4747
if (Helpers.IsGetOrHeadMethod(context.Request.Method)
4848
&& Helpers.TryMatchPath(context, _matchUrl, forDirectory: true, subpath: out subpath))
4949
{
50-
var dirContents = _options.FileSystem.GetDirectoryContents(subpath.Value);
50+
var dirContents = _options.FileProvider.GetDirectoryContents(subpath.Value);
5151
if (dirContents.Exists)
5252
{
5353
// Check if any of our default files exist.
5454
for (int matchIndex = 0; matchIndex < _options.DefaultFileNames.Count; matchIndex++)
5555
{
5656
string defaultFile = _options.DefaultFileNames[matchIndex];
57-
var file = _options.FileSystem.GetFileInfo(subpath + defaultFile);
57+
var file = _options.FileProvider.GetFileInfo(subpath + defaultFile);
5858
// TryMatchPath will make sure subpath always ends with a "/" by adding it if needed.
5959
if (file.Exists)
6060
{

src/Microsoft.AspNet.StaticFiles/DirectoryBrowserMiddleware.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System;
55
using System.Threading.Tasks;
66
using Microsoft.AspNet.Builder;
7-
using Microsoft.AspNet.FileSystems;
7+
using Microsoft.AspNet.FileProviders;
88
using Microsoft.AspNet.Hosting;
99
using Microsoft.AspNet.Http;
1010
using Microsoft.Net.Http.Headers;
@@ -31,7 +31,7 @@ public DirectoryBrowserMiddleware([NotNull] RequestDelegate next, [NotNull] IHos
3131
{
3232
throw new ArgumentException(Resources.Args_NoFormatter);
3333
}
34-
options.ResolveFileSystem(hostingEnv);
34+
options.ResolveFileProvider(hostingEnv);
3535

3636
_next = next;
3737
_options = options;
@@ -69,7 +69,7 @@ public Task Invoke(HttpContext context)
6969

7070
private bool TryGetDirectoryInfo(PathString subpath, out IDirectoryContents contents)
7171
{
72-
contents = _options.FileSystem.GetDirectoryContents(subpath.Value);
72+
contents = _options.FileProvider.GetDirectoryContents(subpath.Value);
7373
return contents.Exists;
7474
}
7575
}

src/Microsoft.AspNet.StaticFiles/HtmlDirectoryFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using System.Net;
99
using System.Text;
1010
using System.Threading.Tasks;
11-
using Microsoft.AspNet.FileSystems;
11+
using Microsoft.AspNet.FileProviders;
1212
using Microsoft.AspNet.Http;
1313

1414
namespace Microsoft.AspNet.StaticFiles

src/Microsoft.AspNet.StaticFiles/IDirectoryFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using System.Collections.Generic;
55
using System.Threading.Tasks;
6-
using Microsoft.AspNet.FileSystems;
6+
using Microsoft.AspNet.FileProviders;
77
using Microsoft.AspNet.Http;
88

99
namespace Microsoft.AspNet.StaticFiles

src/Microsoft.AspNet.StaticFiles/Infrastructure/SharedOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
5-
using Microsoft.AspNet.FileSystems;
5+
using Microsoft.AspNet.FileProviders;
66
using Microsoft.AspNet.Http;
77

88
namespace Microsoft.AspNet.StaticFiles.Infrastructure
@@ -41,6 +41,6 @@ public PathString RequestPath
4141
/// <summary>
4242
/// The file system used to locate resources
4343
/// </summary>
44-
public IFileSystem FileSystem { get; set; }
44+
public IFileProvider FileProvider { get; set; }
4545
}
4646
}

src/Microsoft.AspNet.StaticFiles/Infrastructure/SharedOptionsBase.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
5-
using Microsoft.AspNet.FileSystems;
5+
using Microsoft.AspNet.FileProviders;
66
using Microsoft.AspNet.Hosting;
77
using Microsoft.AspNet.Http;
88

@@ -45,20 +45,20 @@ public PathString RequestPath
4545
/// <summary>
4646
/// The file system used to locate resources
4747
/// </summary>
48-
public IFileSystem FileSystem
48+
public IFileProvider FileProvider
4949
{
50-
get { return SharedOptions.FileSystem; }
51-
set { SharedOptions.FileSystem = value; }
50+
get { return SharedOptions.FileProvider; }
51+
set { SharedOptions.FileProvider = value; }
5252
}
5353

54-
internal void ResolveFileSystem(IHostingEnvironment hostingEnv)
54+
internal void ResolveFileProvider(IHostingEnvironment hostingEnv)
5555
{
56-
if (FileSystem == null)
56+
if (FileProvider == null)
5757
{
58-
FileSystem = hostingEnv.WebRootFileSystem;
59-
if (FileSystem == null)
58+
FileProvider = hostingEnv.WebRootFileProvider;
59+
if (FileProvider == null)
6060
{
61-
throw new InvalidOperationException("Missing FileSystem.");
61+
throw new InvalidOperationException("Missing FileProvider.");
6262
}
6363
}
6464
}

src/Microsoft.AspNet.StaticFiles/StaticFileContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using System.IO;
88
using System.Linq;
99
using System.Threading.Tasks;
10-
using Microsoft.AspNet.FileSystems;
10+
using Microsoft.AspNet.FileProviders;
1111
using Microsoft.AspNet.Http;
1212
using Microsoft.AspNet.Http.Headers;
1313
using Microsoft.AspNet.Http.Interfaces;
@@ -127,7 +127,7 @@ public bool LookupContentType()
127127

128128
public bool LookupFileInfo()
129129
{
130-
_fileInfo = _options.FileSystem.GetFileInfo(_subPath.Value);
130+
_fileInfo = _options.FileProvider.GetFileInfo(_subPath.Value);
131131
if (_fileInfo.Exists)
132132
{
133133
_length = _fileInfo.Length;

src/Microsoft.AspNet.StaticFiles/StaticFileMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System;
55
using System.Threading.Tasks;
66
using Microsoft.AspNet.Builder;
7-
using Microsoft.AspNet.FileSystems;
7+
using Microsoft.AspNet.FileProviders;
88
using Microsoft.AspNet.Hosting;
99
using Microsoft.AspNet.Http;
1010
using Microsoft.Framework.Logging;
@@ -33,7 +33,7 @@ public StaticFileMiddleware([NotNull] RequestDelegate next, [NotNull] IHostingEn
3333
{
3434
throw new ArgumentException(Resources.Args_NoContentTypeProvider);
3535
}
36-
options.ResolveFileSystem(hostingEnv);
36+
options.ResolveFileProvider(hostingEnv);
3737

3838
_next = next;
3939
_options = options;

src/Microsoft.AspNet.StaticFiles/StaticFileResponseContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
using Microsoft.AspNet.FileSystems;
4+
using Microsoft.AspNet.FileProviders;
55
using Microsoft.AspNet.Http;
66

77
namespace Microsoft.AspNet.StaticFiles

0 commit comments

Comments
 (0)