diff --git a/bootstrap/config.go b/bootstrap/config.go index b1fa8c3d..35c220bd 100644 --- a/bootstrap/config.go +++ b/bootstrap/config.go @@ -1,21 +1,22 @@ package bootstrap import ( + "io/ioutil" + "os" + "path/filepath" + "github.com/alist-org/alist/v3/cmd/args" "github.com/alist-org/alist/v3/conf" "github.com/alist-org/alist/v3/pkg/utils" "github.com/caarlos0/env/v6" log "github.com/sirupsen/logrus" - "io/ioutil" - "os" - "path/filepath" ) func InitConfig() { log.Infof("reading config file: %s", args.Config) if !utils.Exists(args.Config) { log.Infof("config file not exists, creating default config file") - _, err := utils.CreatNestedFile(args.Config) + _, err := utils.CreateNestedFile(args.Config) if err != nil { log.Fatalf("failed to create config file") } diff --git a/pkg/utils/file.go b/pkg/utils/file.go index 7a6beaae..d836aeee 100644 --- a/pkg/utils/file.go +++ b/pkg/utils/file.go @@ -20,8 +20,8 @@ func Exists(name string) bool { return true } -// CreatNestedFile create nested file -func CreatNestedFile(path string) (*os.File, error) { +// CreateNestedFile create nested file +func CreateNestedFile(path string) (*os.File, error) { basePath := filepath.Dir(path) if !Exists(basePath) { err := os.MkdirAll(basePath, 0700)