mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-09-06 13:41:46 +00:00
config: Add default values on conversion
When config is created during mixer init, default values are set for all variables. To mimic this behavior, LoadDefaults must be called on conversion as well. There is also no need to perform a conversion if the parsed version number is the same as the current version number. Signed-off-by: Rodrigo Chiossi <rodrigo.chiossi@intel.com>
This commit is contained in:
@@ -449,10 +449,22 @@ func (config *MixConfig) Convert(filename string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := config.LoadDefaults(false); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Reset version for files without versioning
|
||||
config.version = "0.0"
|
||||
|
||||
if err := config.Parse(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Config is already in the current format
|
||||
if config.version == CurrentConfigVersion {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := helpers.CopyFile(config.filename+".bkp", config.filename); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user