Don't gather any entries if the collection directory doesn't exist

This commit is contained in:
Parker Moore 2014-04-14 22:56:23 -04:00
parent ee29bf3939
commit 696aea211a
1 changed files with 11 additions and 0 deletions

View File

@ -38,6 +38,7 @@ module Jekyll
# Returns an Array of file paths to the documents in this collection
# relative to the collection's directory
def entries
return Array.new unless exists?
Dir.glob(File.join(directory, "**", "*.*")).map do |entry|
entry[File.join(directory, "")] = ''; entry
end
@ -69,6 +70,16 @@ module Jekyll
Jekyll.sanitized_path(site.source, relative_directory)
end
# Checks whether the directory "exists" for this collection.
# The directory must exist on the filesystem and must not be a symlink
# if in safe mode.
#
# Returns false if the directory doesn't exist or if it's a symlink
# and we're in safe mode.
def exists?
File.directory?(directory) && !(File.symlink?(directory) && site.safe)
end
# The entry filter for this collection.
# Creates an instance of Jekyll::EntryFilter.
#