Skip to content

Commit

Permalink
dirty check to stop exception when not using pages
Browse files Browse the repository at this point in the history
  • Loading branch information
phillip-haydon committed Mar 29, 2015
1 parent f0c7924 commit d72cc55
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Snow/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,25 @@ private static void Main(string[] args)
.OrderByDescending(x => x.Date)
.Where(x => x.Published != Published.Private && !(x is Post.MissingPost))
.ToList();
var pages = new DirectoryInfo(settings.Pages).EnumerateFiles("*", SearchOption.AllDirectories)

var pages = new List<Page>();

if (!string.IsNullOrWhiteSpace(settings.Pages))
{
pages = new DirectoryInfo(settings.Pages).EnumerateFiles("*", SearchOption.AllDirectories)
.Select(x => PagesParser.GetFileData(x, settings))
.OrderByDescending(x => x.Date)
.Where(x => x.Published != Published.Private && !(x is Post.MissingPost))
.ToList();
pages.SetPostUrl(settings);

TestModule.Pages = pages;
}

posts.SetPostUrl(settings);
pages.SetPostUrl(settings);
posts.UpdatePartsToLatestInSeries();

TestModule.Posts = posts;
TestModule.Pages = pages;
TestModule.Drafts = posts.Where(x => x.Published == Published.Draft).ToList();
TestModule.Categories = CategoriesPage.Create(posts);
TestModule.PostsGroupedByYearThenMonth = ArchivePage.Create(posts);
Expand Down

0 comments on commit d72cc55

Please sign in to comment.