From 6ee9c06cdc7c3f1dcabef12b0b107750dd3c1741 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 12 Oct 2014 21:12:42 -0700 Subject: [PATCH] config/module: copyDir properly copies files in subdirectories --- config/module/copy_dir.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/module/copy_dir.go b/config/module/copy_dir.go index 72c3dad2f..a6628d1d7 100644 --- a/config/module/copy_dir.go +++ b/config/module/copy_dir.go @@ -23,8 +23,7 @@ func copyDir(dst, src string) error { return nil } - basePath := filepath.Base(path) - if strings.HasPrefix(basePath, ".") { + if strings.HasPrefix(filepath.Base(path), ".") { // Skip any dot files if info.IsDir() { return filepath.SkipDir @@ -33,7 +32,9 @@ func copyDir(dst, src string) error { } } - dstPath := filepath.Join(dst, basePath) + // The "path" has the src prefixed to it. We need to join our + // destination with the path without the src on it. + dstPath := filepath.Join(dst, path[len(src):]) // If we have a directory, make that subdirectory, then continue // the walk.