Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

fix: fix path handling error on windows #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions template/resource_template_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"io"
"io/ioutil"
"os"
"path"
"path/filepath"

"github.com/hashicorp/terraform/helper/pathorcontents"
Expand Down Expand Up @@ -106,7 +105,7 @@ func resourceTemplateDirCreate(d *schema.ResourceData, meta interface{}) error {
}

relPath, _ := filepath.Rel(sourceDir, p)
return generateDirFile(p, path.Join(destinationDir, relPath), f, vars)
return generateDirFile(p, filepath.Join(destinationDir, relPath), f, vars)
})
if err != nil {
return err
Expand Down Expand Up @@ -148,7 +147,7 @@ func generateDirFile(sourceDir, destinationDir string, f os.FileInfo, vars map[s
return templateRenderError(fmt.Errorf("failed to render %v: %v", sourceDir, err))
}

outputDir := path.Dir(destinationDir)
outputDir := filepath.Dir(destinationDir)
if _, err := os.Stat(outputDir); err != nil {
if err := os.MkdirAll(outputDir, 0777); err != nil {
return err
Expand Down