mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 19:37:46 +08:00
config: Made WriteConfigFile create config parent directory if it doesn't exist
This commit is contained in:
parent
5059654ec4
commit
f1e088508a
@ -22,6 +22,11 @@ func ReadConfigFile(filename string, cfg interface{}) error {
|
||||
|
||||
// WriteConfigFile writes the config from `cfg` into `filename`.
|
||||
func WriteConfigFile(filename string, cfg interface{}) error {
|
||||
err := os.MkdirAll(filepath.Dir(filename), 0775)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f, err := os.Create(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Loading…
Reference in New Issue
Block a user