Skip to content

Commit

Permalink
fix windows file path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
djyde authored May 9, 2022
1 parent d55e494 commit 23e46ff
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions process.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"io/ioutil"
"log"
"os"
"path"
"path/filepath"
"strings"
)
Expand Down Expand Up @@ -37,20 +36,20 @@ func ParseSnpFiles() []byte {
cwd, _ := os.Getwd()

snippet := make(map[string]snippetItem)
err := filepath.Walk(cwd, func(filePath string, info os.FileInfo, err error) error {
err := filepath.Walk(cwd, func(fp string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if strings.HasSuffix(filePath, ".snp") {
if strings.HasSuffix(fp, ".snp") {

attribute := attr{}

rawContent, readFileErr := ioutil.ReadFile(filePath)
rawContent, readFileErr := ioutil.ReadFile(fp)
if readFileErr != nil {
log.Fatal(err)
}

filename := path.Base(filePath)
filename := filepath.Base(fp)
prefix := filename[0 : len(filename)-4]

content, parseFmErr := Unmarshal(rawContent, &attribute)
Expand Down

0 comments on commit 23e46ff

Please sign in to comment.