1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-09 17:45:03 +09:00

Merge pull request #374 from grishy/main

nodeconfstore: Create dir with MkdirAll
This commit is contained in:
Sergey Cherepanov 2025-02-01 12:36:32 +01:00 committed by GitHub
commit f28ee02250
Signed by: github
GPG key ID: B5690EEEBB952194

View file

@ -2,12 +2,13 @@ package nodeconfstore
import (
"context"
"github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/nodeconf"
"gopkg.in/yaml.v3"
"os"
"path/filepath"
"sync"
"github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/nodeconf"
"gopkg.in/yaml.v3"
)
func New() NodeConfStore {
@ -30,7 +31,7 @@ type configGetter interface {
func (n *nodeConfStore) Init(a *app.App) (err error) {
n.path = a.MustComponent("config").(configGetter).GetNodeConfStorePath()
if e := os.Mkdir(n.path, 0755); e != nil && !os.IsExist(e) {
if e := os.MkdirAll(n.path, 0o755); e != nil && !os.IsExist(e) {
return e
}
return
@ -61,5 +62,5 @@ func (n *nodeConfStore) SaveLast(ctx context.Context, c nodeconf.Configuration)
if err != nil {
return
}
return os.WriteFile(path, data, 0644)
return os.WriteFile(path, data, 0o644)
}