expand_path on custom source directories. Fixes #1823

This commit is contained in:
Thomas Reynolds 2016-03-02 12:54:14 -08:00
parent 7b59f240d5
commit 737e6f5e64
2 changed files with 4 additions and 2 deletions

View file

@ -116,7 +116,8 @@ module Middleman
Contract Or[Symbol, HANDLER], Maybe[Hash] => HANDLER
def watch(type_or_handler, options={})
handler = if type_or_handler.is_a? Symbol
SourceWatcher.new(self, type_or_handler, options.delete(:path), options)
path = File.expand_path(options.delete(:path), app.root)
SourceWatcher.new(self, type_or_handler, path, options)
else
type_or_handler
end

View file

@ -92,7 +92,7 @@ module Middleman
# @return [void]
Contract String => Any
def update_path(directory)
@directory = Pathname(directory)
@directory = Pathname(File.expand_path(directory, app.root))
stop_listener! if @listener
@ -133,6 +133,7 @@ module Middleman
return nil if p.absolute? && !p.to_s.start_with?(@directory.to_s)
p = @directory + p if p.relative?
if glob
@extensionless_files[p]
else