fix: typo

refactor/fs
Noah Hsu 2022-06-15 14:57:13 +08:00
parent 066ddd3e09
commit c65a9b3001
2 changed files with 7 additions and 6 deletions

View File

@ -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")
}

View File

@ -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)