Always try to unwatch current user keymap

This commit is contained in:
probablycorey
2014-01-02 09:56:41 -08:00
parent 88ee021b4d
commit d56137e3c0

View File

@@ -126,16 +126,17 @@ class Keymap
CSON.resolve(path.join(@configDirPath, 'keymap'))
unwatchUserKeymap: ->
return unless keymapPath = @userKeymapPath()
@remove(keymapPath)
keymapPath = @userKeymapPath()
@userKeymapFile?.off()
@remove(keymapPath) if keymapPath
loadUserKeymap: ->
return unless keymapPath = @userKeymapPath()
keymapPath = @userKeymapPath()
@unwatchUserKeymap()
@load(keymapPath)
@userKeymapFile = new File(keymapPath)
@userKeymapFile.on 'contents-changed', => @loadUserKeymap()
if keymapPath
@load(keymapPath)
@userKeymapFile = new File(keymapPath)
@userKeymapFile.on 'contents-changed', => @loadUserKeymap()
loadDirectory: (directoryPath) ->
@load(filePath) for filePath in fs.listSync(directoryPath, ['.cson', '.json'])