Don't load keymap files with other platforms in the suffix

Example: On osx `keymap.cson` and `keymap-darwin.cson` would load. But
`keymap-win32.cson` would not load.
This commit is contained in:
probablycorey
2014-01-21 16:03:34 -08:00
parent 627e43dccf
commit 2e4e178091
2 changed files with 28 additions and 1 deletions

View File

@@ -142,7 +142,13 @@ class Keymap
@userKeymapFile.on 'contents-changed moved removed', => @loadUserKeymap()
loadDirectory: (directoryPath) ->
@load(filePath) for filePath in fs.listSync(directoryPath, ['.cson', '.json'])
platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32']
otherPlatforms = platforms.filter (name) -> name != process.platform
for filePath in fs.listSync(directoryPath, ['.cson', '.json'])
platform = filePath.match(/-(\w+)\.\w+$/)?[1]
continue if platform in otherPlatforms
@load(filePath)
load: (path) ->
@add(path, CSON.readFileSync(path))