Browse Source

add util.PathJoin

pull/1287/head
Chris Lu 5 years ago
parent
commit
7bc3c93512
  1. 3
      weed/server/volume_grpc_copy.go
  2. 4
      weed/util/fullpath.go

3
weed/server/volume_grpc_copy.go

@ -6,7 +6,6 @@ import (
"io"
"math"
"os"
"path"
"time"
"github.com/chrislusf/seaweedfs/weed/glog"
@ -226,7 +225,7 @@ func (vs *VolumeServer) CopyFile(req *volume_server_pb.CopyFileRequest, stream v
} else {
baseFileName := erasure_coding.EcShardBaseFileName(req.Collection, int(req.VolumeId)) + req.Ext
for _, location := range vs.store.Locations {
tName := path.Join(location.Directory, baseFileName)
tName := util.PathJoin(location.Directory, baseFileName)
if util.FileExists(tName) {
fileName = tName
}

4
weed/util/fullpath.go

@ -46,3 +46,7 @@ func (fp FullPath) Split() []string {
}
return strings.Split(string(fp)[1:], "/")
}
func PathJoin(dir, name string) string {
return filepath.ToSlash(filepath.Join(dir, name))
}
Loading…
Cancel
Save