config/module: copyDir properly copies files in subdirectories

This commit is contained in:
Mitchell Hashimoto 2014-10-12 21:12:42 -07:00
parent 12c178bc63
commit 6ee9c06cdc
1 changed files with 4 additions and 3 deletions

View File

@ -23,8 +23,7 @@ func copyDir(dst, src string) error {
return nil return nil
} }
basePath := filepath.Base(path) if strings.HasPrefix(filepath.Base(path), ".") {
if strings.HasPrefix(basePath, ".") {
// Skip any dot files // Skip any dot files
if info.IsDir() { if info.IsDir() {
return filepath.SkipDir 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 // If we have a directory, make that subdirectory, then continue
// the walk. // the walk.