From 264dfc164d5a5f0e567eace68398843f057c53bb Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 16 Feb 2014 22:00:33 -0500 Subject: [PATCH] When an include cannot be found, only print file path relative to source. --- lib/jekyll/tags/include.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb index db19ed8a..aa608bc0 100644 --- a/lib/jekyll/tags/include.rb +++ b/lib/jekyll/tags/include.rb @@ -119,10 +119,14 @@ eos if safe && !realpath_prefixed_with?(path, dir) raise IOError.new "The included file '#{path}' should exist and should not be a symlink" elsif !File.exist?(path) - raise IOError.new "Included file '#{path}' not found" + raise IOError.new "Included file '#{path_relative_to_source(dir, path)}' not found" end end + def path_relative_to_source(dir, path) + File.join(INCLUDES_DIR, path.sub(Regexp.new("^#{dir}"), "")) + end + def realpath_prefixed_with?(path, dir) File.exist?(path) && File.realpath(path).start_with?(dir) end