1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-09-16 22:10:42 +02:00

add util.PathJoin

This commit is contained in:
Chris Lu 2020-04-05 12:40:46 -07:00
parent af1f64d244
commit 7bc3c93512
2 changed files with 5 additions and 2 deletions

View file

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

View file

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