1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-22 21:29:02 +08:00

fix: panic when config dir access denied

This commit is contained in:
oldshensheep 2023-09-19 20:13:56 +08:00 committed by zu1k
parent 20a0de63f1
commit f91569c506

View File

@ -37,13 +37,13 @@ func init() {
func prepareDir(dir string) {
stat, err := os.Stat(dir)
if err != nil && os.IsNotExist(err) {
if os.IsNotExist(err) {
if err := os.MkdirAll(dir, 0755); err != nil {
log.Fatal("can not create config dir:", dir)
}
} else {
if !stat.IsDir() {
} else if err != nil {
log.Fatal(err)
} else if !stat.IsDir() {
log.Fatal("path already exists, but not a dir:", dir)
}
}
}