mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
fix: ensure the configuration path exists (#19)
This commit is contained in:
parent
626a7d6059
commit
238ec25314
@ -2,6 +2,7 @@ package model
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -131,5 +132,11 @@ func (c *Config) Save() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dir := filepath.Dir(c.filePath)
|
||||||
|
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return os.WriteFile(c.filePath, data, 0600)
|
return os.WriteFile(c.filePath, data, 0600)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user