mirror of https://github.com/Xhofe/alist
feat(local): check root folder while init
parent
9fcdbec5c9
commit
4fa7846f00
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/alist-org/alist/v3/internal/driver"
|
||||
"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/pkg/errors"
|
||||
)
|
||||
|
@ -25,7 +26,14 @@ func (d *Driver) Init(ctx context.Context, account model.Account) error {
|
|||
if err != nil {
|
||||
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 {
|
||||
|
|
|
@ -31,3 +31,7 @@ type Proxy struct {
|
|||
func (a Account) GetAccount() Account {
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *Account) SetStatus(status string) {
|
||||
a.Status = status
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue