// UpdateFolder updates a specific folder into the current configuration
func (c *Config) UpdateFolder(newFolder FolderConfig) (FolderConfig, error) {
+ // rootPath should not be empty
+ if newFolder.rootPath == "" {
+ newFolder.rootPath = c.ShareRootDir
+ }
+
+ // Sanity check of folder settings
if err := FolderVerify(newFolder); err != nil {
return FolderConfig{}, err
}
err = fmt.Errorf("device id not set (SyncThingID field)")
}
+ if fCfg.rootPath == "" {
+ err = fmt.Errorf("rootPath must not be empty")
+ }
+
if err != nil {
fCfg.Status = FolderStatusErrorConfig
log.Printf("ERROR FolderVerify: %v\n", err)