Added check for copy dir

CopyDir should not fail if the source folder does not exist.
This commit is contained in:
Steve
2018-10-10 11:40:29 -07:00
committed by GitHub
parent be7bebd962
commit 644d6e12bd

View File

@@ -160,6 +160,9 @@ func PanicOnError(err error, msg string) {
// Additionally, the trailing ".template" is stripped from the file name.
// Also, dot files and dot directories are skipped.
func CopyDir(destDir, srcDir string, data map[string]interface{}) error {
if !DirExists(srcDir) {
return nil
}
return fsWalk(srcDir, srcDir, func(srcPath string, info os.FileInfo, err error) error {
// Get the relative path from the source base, and the corresponding path in
// the dest directory.