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:
parent
20a0de63f1
commit
f91569c506
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user