mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 00:13:49 +01:00
fs: fix the defaults overriding the actual config
After re-organising the config it became apparent that there was a bug in the config system which hadn't manifested until now. This was the default config overriding the main config and was fixed by noting when the defaults had actually changed.
This commit is contained in:
parent
8fbb259091
commit
91558ce6aa
@ -64,7 +64,7 @@ type regInfoValues struct {
|
||||
// the default values
|
||||
func (r *regInfoValues) Get(key string) (value string, ok bool) {
|
||||
opt := r.options.Get(key)
|
||||
if opt != nil && (r.useDefault || opt.Value != nil) {
|
||||
if opt != nil && (r.useDefault || !opt.IsDefault()) {
|
||||
return opt.String(), true
|
||||
}
|
||||
return "", false
|
||||
|
@ -244,6 +244,18 @@ func (o *Option) GetValue() interface{} {
|
||||
return val
|
||||
}
|
||||
|
||||
// IsDefault returns true if the value is the default value
|
||||
func (o *Option) IsDefault() bool {
|
||||
if o.Value == nil {
|
||||
return true
|
||||
}
|
||||
Default := o.Default
|
||||
if Default == nil {
|
||||
Default = ""
|
||||
}
|
||||
return reflect.DeepEqual(o.Value, Default)
|
||||
}
|
||||
|
||||
// String turns Option into a string
|
||||
func (o *Option) String() string {
|
||||
v := o.GetValue()
|
||||
|
Loading…
Reference in New Issue
Block a user