Permalink
Browse files

Fixes for Razor partials and html file location

  • Loading branch information...
1 parent 5f52736 commit efcff4b7867f924b585c6e1e3a3940a92f518771 @grumpydev grumpydev committed Oct 3, 2011
@@ -28,6 +28,8 @@ protected override void InitialiseInternal(TinyIoC.TinyIoCContainer container)
{
base.InitialiseInternal(container);
+ StaticConfiguration.DisableErrorTraces = false;
+
this.Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("moo", "Content"));
CookieBasedSessions.Enable(this);
@@ -38,7 +38,7 @@ public MainModule(IRouteCacheProvider routeCacheProvider)
};
Get["/static"] = x => {
- return View["static.htm"];
+ return View["static"];
};
Get["/razor"] = x => {
@@ -101,7 +101,7 @@
<Content Include="Content\main.css" />
<Content Include="Content\scripts.js" />
<Content Include="Views\javascript.html" />
- <Content Include="Views\static.htm" />
+ <Content Include="Views\static.html" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
@@ -19,17 +19,15 @@ public class DefaultFileSystemReader : IFileSystemReader
public IEnumerable<Tuple<string, Func<StreamReader>>> GetViewsWithSupportedExtensions(string path, IEnumerable<string> supportedViewExtensions)
{
return supportedViewExtensions
- .SelectMany(extension => GetFileInformation(path, extension))
- .Distinct().ToList();
+ .SelectMany(extension => GetFilenames(path, extension))
+ .Distinct()
+ .Select(file => new Tuple<string, Func<StreamReader>>(file, () => new StreamReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))))
+ .ToList();
}
- private static IEnumerable<Tuple<string, Func<StreamReader>>> GetFileInformation(string path, string extension)
+ private static IEnumerable<string> GetFilenames(string path, string extension)
{
- var files = Directory
- .GetFiles(path, string.Concat("*.", extension), SearchOption.AllDirectories)
- .Distinct();
-
- return files.Select(file => new Tuple<string, Func<StreamReader>>(file, () => new StreamReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))));
+ return Directory.GetFiles(path, string.Concat("*.", extension), SearchOption.AllDirectories);
}
}
}

0 comments on commit efcff4b

Please sign in to comment.