Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

add util.PathJoin

Chris Lu7bc3c935122f
diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.go
index 818123bf47..9df9f31491 100644
--- a/weed/server/volume_grpc_copy.go
+++ b/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
}
diff --git a/weed/util/fullpath.go b/weed/util/fullpath.go
index 7f7a777340..413ee27bf7 100644
--- a/weed/util/fullpath.go
+++ b/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))
+}
\ No newline at end of file