mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
change to util.WriteFile
This commit is contained in:
parent
76e297d64f
commit
affe3c2c12
|
@ -2,7 +2,7 @@ package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"github.com/chrislusf/seaweedfs/weed/util"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/command/scaffold"
|
"github.com/chrislusf/seaweedfs/weed/command/scaffold"
|
||||||
|
@ -56,7 +56,7 @@ func runScaffold(cmd *Command, args []string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
if *outputPath != "" {
|
if *outputPath != "" {
|
||||||
os.WriteFile(filepath.Join(*outputPath, *config+".toml"), []byte(content), 0644)
|
util.WriteFile(filepath.Join(*outputPath, *config+".toml"), []byte(content), 0644)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println(content)
|
fmt.Println(content)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package images
|
package images
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/util"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
@ -12,7 +13,7 @@ func TestXYZ(t *testing.T) {
|
||||||
|
|
||||||
fixed_data := FixJpgOrientation(dat)
|
fixed_data := FixJpgOrientation(dat)
|
||||||
|
|
||||||
os.WriteFile("fixed1.jpg", fixed_data, 0644)
|
util.WriteFile("fixed1.jpg", fixed_data, 0644)
|
||||||
|
|
||||||
os.Remove("fixed1.jpg")
|
os.Remove("fixed1.jpg")
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ func TestResizing(t *testing.T) {
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
buf.ReadFrom(resized)
|
buf.ReadFrom(resized)
|
||||||
|
|
||||||
os.WriteFile("resized1.png", buf.Bytes(), 0644)
|
util.WriteFile("resized1.png", buf.Bytes(), 0644)
|
||||||
|
|
||||||
os.Remove("resized1.png")
|
os.Remove("resized1.png")
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ func (progress *KafkaProgress) saveProgress() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to marshal progress: %v", err)
|
return fmt.Errorf("failed to marshal progress: %v", err)
|
||||||
}
|
}
|
||||||
err = os.WriteFile(progress.offsetFile, data, 0640)
|
err = util.WriteFile(progress.offsetFile, data, 0640)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to save progress to %s: %v", progress.offsetFile, err)
|
return fmt.Errorf("failed to save progress to %s: %v", progress.offsetFile, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ func (vs *VolumeServer) VolumeCopy(req *volume_server_pb.VolumeCopyRequest, stre
|
||||||
dataBaseFileName = storage.VolumeFileName(location.Directory, volFileInfoResp.Collection, int(req.VolumeId))
|
dataBaseFileName = storage.VolumeFileName(location.Directory, volFileInfoResp.Collection, int(req.VolumeId))
|
||||||
indexBaseFileName = storage.VolumeFileName(location.IdxDirectory, volFileInfoResp.Collection, int(req.VolumeId))
|
indexBaseFileName = storage.VolumeFileName(location.IdxDirectory, volFileInfoResp.Collection, int(req.VolumeId))
|
||||||
|
|
||||||
os.WriteFile(dataBaseFileName+".note", []byte(fmt.Sprintf("copying from %s", req.SourceDataNode)), 0755)
|
util.WriteFile(dataBaseFileName+".note", []byte(fmt.Sprintf("copying from %s", req.SourceDataNode)), 0755)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue