Skip to content

Commit

Permalink
Merge pull request #1 from err0r500/master
Browse files Browse the repository at this point in the history
fix escaped antislashes in paths (windows only)
  • Loading branch information
depado authored May 21, 2019
2 parents 6426812 + a9ddc3c commit 2c9f6ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion conf/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,13 @@ func (f *File) WriteRender(ctx map[string]interface{}, delims []string) error {
if fd, err = os.Create(f.NewPath + ".rendered"); err != nil {
return err
}
defer fd.Close()

if err = t.Execute(fd, ctx); err != nil {
fd.Close()
return err
}

fd.Close()
return os.Rename(rdr, f.NewPath)
}

Expand Down
2 changes: 1 addition & 1 deletion conf/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (r Root) ExecuteCommands(dir string) {

// NewPath adds the path where the file should be rendered according to the root
func (r Root) NewPath(f *File, new string) {
f.NewPath = strings.Replace(f.Path, r.File.Dir, new, 1)
f.NewPath = filepath.ToSlash(strings.Replace(f.Path, r.File.Dir, new, 1))
}

// NewRootConfig will return the root configuration
Expand Down

0 comments on commit 2c9f6ce

Please sign in to comment.