#46 cross platform support

This commit is contained in:
Jeevanandam M
2016-06-07 00:16:51 -07:00
parent 4b9e74e1ea
commit e485de7e9c
5 changed files with 29 additions and 30 deletions

View File

@@ -6,7 +6,6 @@ import (
"fmt"
"io"
"os"
"path"
"path/filepath"
"strings"
"text/template"
@@ -70,7 +69,7 @@ func mustCopyDir(destDir, srcDir string, data map[string]interface{}) error {
// Get the relative path from the source base, and the corresponding path in
// the dest directory.
relSrcPath := strings.TrimLeft(srcPath[len(srcDir):], string(os.PathSeparator))
destPath := path.Join(destDir, relSrcPath)
destPath := filepath.Join(destDir, relSrcPath)
// Skip dot files and dot directories.
if strings.HasPrefix(relSrcPath, ".") {
@@ -82,7 +81,7 @@ func mustCopyDir(destDir, srcDir string, data map[string]interface{}) error {
// Create a subdirectory if necessary.
if info.IsDir() {
err := os.MkdirAll(path.Join(destDir, relSrcPath), 0777)
err := os.MkdirAll(filepath.Join(destDir, relSrcPath), 0777)
if !os.IsExist(err) {
panicOnError(err, "Failed to create directory")
}