1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 10:49:24 +08:00

path.Join for cross platform goodness

This commit is contained in:
Jeromy
2015-02-23 21:56:41 -08:00
parent 856c87bdc0
commit 88b5a1a019

View File

@ -6,6 +6,7 @@ import (
//context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" //context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"testing" "testing"
fstest "github.com/jbenet/go-ipfs/Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil" fstest "github.com/jbenet/go-ipfs/Godeps/_workspace/src/bazil.org/fuse/fs/fstestutil"
@ -77,7 +78,7 @@ func TestIpfsBasicRead(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
fname := mnt.Dir + "/" + k.String() fname := path.Join(mnt.Dir, k.String())
rbuf, err := ioutil.ReadFile(fname) rbuf, err := ioutil.ReadFile(fname)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -116,8 +117,8 @@ func TestIpfsBasicDirRead(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
dirname := mnt.Dir + "/" + d1ndk.String() dirname := path.Join(mnt.Dir, d1ndk.String())
fname := dirname + "/actual" fname := path.Join(dirname, "actual")
rbuf, err := ioutil.ReadFile(fname) rbuf, err := ioutil.ReadFile(fname)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -153,7 +154,7 @@ func TestFileSizeReporting(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
fname := mnt.Dir + "/" + k.String() fname := path.Join(mnt.Dir, k.String())
finfo, err := os.Stat(fname) finfo, err := os.Stat(fname)
if err != nil { if err != nil {