feat(local): check root folder while init
This commit is contained in:
parent
9fcdbec5c9
commit
4fa7846f00
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/alist-org/alist/v3/internal/driver"
|
"github.com/alist-org/alist/v3/internal/driver"
|
||||||
"github.com/alist-org/alist/v3/internal/model"
|
"github.com/alist-org/alist/v3/internal/model"
|
||||||
|
"github.com/alist-org/alist/v3/internal/operations"
|
||||||
"github.com/alist-org/alist/v3/pkg/utils"
|
"github.com/alist-org/alist/v3/pkg/utils"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
@ -25,7 +26,14 @@ func (d *Driver) Init(ctx context.Context, account model.Account) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error while unmarshal addition")
|
return errors.Wrap(err, "error while unmarshal addition")
|
||||||
}
|
}
|
||||||
return nil
|
if !utils.Exists(d.RootFolder) {
|
||||||
|
err = errors.Errorf("root folder %s not exists", d.RootFolder)
|
||||||
|
d.SetStatus(err.Error())
|
||||||
|
} else {
|
||||||
|
d.SetStatus("OK")
|
||||||
|
}
|
||||||
|
operations.SaveDriverAccount(d)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) Drop(ctx context.Context) error {
|
func (d *Driver) Drop(ctx context.Context) error {
|
||||||
|
@ -31,3 +31,7 @@ type Proxy struct {
|
|||||||
func (a Account) GetAccount() Account {
|
func (a Account) GetAccount() Account {
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Account) SetStatus(status string) {
|
||||||
|
a.Status = status
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user