From 47babef79a4aa4a13ca9645d9a5280f911ca50da Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 16 Feb 2014 22:42:38 -0500 Subject: [PATCH] Make the layouts: config key relative to CWD or to Source Fixes #1576. --- lib/jekyll/layout_reader.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/layout_reader.rb b/lib/jekyll/layout_reader.rb index 1b07c724..20ac25c0 100644 --- a/lib/jekyll/layout_reader.rb +++ b/lib/jekyll/layout_reader.rb @@ -34,7 +34,22 @@ module Jekyll end def layout_directory - File.join(site.source, site.config['layouts']) + @layout_directory = (layout_directory_in_cwd || layout_directory_inside_source) + end + + def layout_directory_inside_source + # TODO: Fix for Windows + File.join(site.source, File.expand_path(site.config['layouts'], "/")) + end + + def layout_directory_in_cwd + # TODO: Fix on Windows + dir = File.join(Dir.pwd, File.expand_path(site.config['layouts'], '/')) + if Directory.exists?(dir) + dir + else + nil + end end end end