forked from TrueCloudLab/rclone
config: create config directory on save if it is missing
This commit is contained in:
parent
bc17ca7ed9
commit
e600217666
1 changed files with 4 additions and 0 deletions
|
@ -445,6 +445,10 @@ func changeConfigPassword() {
|
||||||
// if configKey has been set, the file will be encrypted.
|
// if configKey has been set, the file will be encrypted.
|
||||||
func saveConfig() error {
|
func saveConfig() error {
|
||||||
dir, name := filepath.Split(ConfigPath)
|
dir, name := filepath.Split(ConfigPath)
|
||||||
|
err := os.MkdirAll(dir, os.ModePerm)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "failed to create config directory")
|
||||||
|
}
|
||||||
f, err := ioutil.TempFile(dir, name)
|
f, err := ioutil.TempFile(dir, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Errorf("Failed to create temp file for new config: %v", err)
|
return errors.Errorf("Failed to create temp file for new config: %v", err)
|
||||||
|
|
Loading…
Reference in a new issue