Make base menus platform dependent

This fixes the most egrerious errors on Windows but there's still room
for improvement.

Refs #1085
This commit is contained in:
Matt Colyer
2013-11-14 10:15:23 -08:00
parent fe0cc7d273
commit 5454e93168
3 changed files with 177 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ class MenuManager
# Private:
constructor: ({@resourcePath}) ->
@template = []
atom.keymap.on 'bundled-keymaps-loaded', => @loadCoreItems()
atom.keymap.on 'bundled-keymaps-loaded', => @loadPlatformItems()
# Public: Adds the given item definition to the existing template.
#
@@ -35,12 +35,11 @@ class MenuManager
@sendToBrowserProcess(@template, keystrokesByCommand)
# Private
loadCoreItems: ->
loadPlatformItems: ->
menusDirPath = path.join(@resourcePath, 'menus')
menuPaths = fs.listSync(menusDirPath, ['cson', 'json'])
for menuPath in menuPaths
data = CSON.readFileSync(menuPath)
@add(data.menu)
platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json'])
data = CSON.readFileSync(platformMenuPath)
@add(data.menu)
# Private: Merges an item in a submenu aware way such that new items are always
# appended to the bottom of existing menus where possible.