Skip to content

Commit

Permalink
fix #2190 - don't use backslash for "embed" paths on windows (#2191)
Browse files Browse the repository at this point in the history
  • Loading branch information
vikstrous committed May 24, 2022
1 parent 0cce554 commit 41daa5d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion codegen/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package codegen
import (
"fmt"
"os"
"path"
"path/filepath"
"sort"
"strings"
Expand Down Expand Up @@ -177,11 +178,12 @@ func BuildData(cfg *config.Config) (*Data, error) {
return nil, fmt.Errorf("failed to get working directory: %w", err)
}
outputDir := cfg.Exec.Dir()
sourcePath := filepath.Join(wd, s.Name)
sourcePath := path.Join(wd, s.Name)
relative, err := filepath.Rel(outputDir, sourcePath)
if err != nil {
return nil, fmt.Errorf("failed to compute path of %s relative to %s: %w"+sourcePath, outputDir, err)
}
relative = filepath.ToSlash(relative)
embeddable := true
if strings.HasPrefix(relative, "..") {
embeddable = false
Expand Down

0 comments on commit 41daa5d

Please sign in to comment.