Check for existence before copying

This commit is contained in:
Kevin Sawicki
2013-10-28 13:53:51 -07:00
parent 41f6d6b0dd
commit 6364589630

View File

@@ -4,6 +4,9 @@ walkdir = require 'walkdir'
module.exports = (grunt) ->
cp: (source, destination, {filter}={}) ->
unless grunt.file.exists(source)
grunt.fatal("Cannot copy non-existent #{source.cyan} to #{destination.cyan}")
try
walkdir.sync source, (sourcePath, stats) ->
return if filter?.test(sourcePath)