fix: typo
This commit is contained in:
parent
066ddd3e09
commit
c65a9b3001
@ -1,21 +1,22 @@
|
|||||||
package bootstrap
|
package bootstrap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/alist-org/alist/v3/cmd/args"
|
"github.com/alist-org/alist/v3/cmd/args"
|
||||||
"github.com/alist-org/alist/v3/conf"
|
"github.com/alist-org/alist/v3/conf"
|
||||||
"github.com/alist-org/alist/v3/pkg/utils"
|
"github.com/alist-org/alist/v3/pkg/utils"
|
||||||
"github.com/caarlos0/env/v6"
|
"github.com/caarlos0/env/v6"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitConfig() {
|
func InitConfig() {
|
||||||
log.Infof("reading config file: %s", args.Config)
|
log.Infof("reading config file: %s", args.Config)
|
||||||
if !utils.Exists(args.Config) {
|
if !utils.Exists(args.Config) {
|
||||||
log.Infof("config file not exists, creating default config file")
|
log.Infof("config file not exists, creating default config file")
|
||||||
_, err := utils.CreatNestedFile(args.Config)
|
_, err := utils.CreateNestedFile(args.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to create config file")
|
log.Fatalf("failed to create config file")
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ func Exists(name string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatNestedFile create nested file
|
// CreateNestedFile create nested file
|
||||||
func CreatNestedFile(path string) (*os.File, error) {
|
func CreateNestedFile(path string) (*os.File, error) {
|
||||||
basePath := filepath.Dir(path)
|
basePath := filepath.Dir(path)
|
||||||
if !Exists(basePath) {
|
if !Exists(basePath) {
|
||||||
err := os.MkdirAll(basePath, 0700)
|
err := os.MkdirAll(basePath, 0700)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user