Skip to content

Commit 58602bf

Browse files
committed
fixed separator for binary loading
1 parent 5567ae5 commit 58602bf

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cowsay.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"io/ioutil"
55
"math/rand"
66
"os"
7+
"path"
78
"path/filepath"
89
"sort"
910
"strings"
@@ -74,10 +75,12 @@ type CowFile struct {
7475
// If LocationType is InBinary, the file read from binary.
7576
// otherwise reads from file system.
7677
func (c *CowFile) ReadAll() ([]byte, error) {
77-
joinedPath := filepath.Join(c.BasePath, c.Name+".cow")
7878
if c.LocationType == InBinary {
79+
// go embed is used "/" separator
80+
joinedPath := path.Join(c.BasePath, c.Name+".cow")
7981
return Asset(joinedPath)
8082
}
83+
joinedPath := filepath.Join(c.BasePath, c.Name+".cow")
8184
return ioutil.ReadFile(joinedPath)
8285
}
8386

cowsay_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestCows(t *testing.T) {
5353

5454
wants := []*CowPath{
5555
{
56-
Name: "testdata/testdir",
56+
Name: filepath.Join("testdata", "testdir"),
5757
LocationType: InDirectory,
5858
},
5959
{

0 commit comments

Comments
 (0)