mirror of
https://github.com/atom/atom.git
synced 2026-02-05 20:25:04 -05:00
Don't store config values that equal their default config value
If 'foo' has not been set and has a default value of 1,
config.set('foo', 1) will not store the 1.
If 'foo' has been set to X and has a default value of 1,
config.set('foo', 1) will remove 'foo' from config
This commit is contained in:
@@ -127,8 +127,10 @@ class Config
|
||||
#
|
||||
# Returns the `value`.
|
||||
set: (keyPath, value) ->
|
||||
_.setValueForKeyPath(@settings, keyPath, value)
|
||||
@update()
|
||||
if @get(keyPath) != value
|
||||
value = undefined if _.valueForKeyPath(@defaultSettings, keyPath) == value
|
||||
_.setValueForKeyPath(@settings, keyPath, value)
|
||||
@update()
|
||||
value
|
||||
|
||||
setDefaults: (keyPath, defaults) ->
|
||||
|
||||
Reference in New Issue
Block a user