Show Atom's version.

This commit is contained in:
Cheng Zhao
2013-05-24 23:24:46 +08:00
parent 22d77af409
commit a00fe91fca
4 changed files with 30 additions and 1 deletions

View File

@@ -262,4 +262,4 @@ window.atom =
console.error "Failed to load `#{userInitScriptPath}`", error.stack, error
getVersion: ->
@sendMessageToBrowserProcess('getVersion')
ipc.sendChannelSync 'get-version'

View File

@@ -13,6 +13,9 @@ testMode = false
getHomeDir = ->
process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
getVersion = ->
String fs.readFileSync(path.join(__dirname, '..', '..', 'version'))
setupNodePath = ->
resourcePaths = [
'src/stdlib',
@@ -120,6 +123,7 @@ class AtomApplication
label: 'Atom'
submenu: [
{ label: 'About Atom', selector: 'orderFrontStandardAboutPanel:' }
{ label: "Version #{getVersion()}", enabled: false }
{ type: 'separator' }
{ label: 'Preferences...', accelerator: 'Command+,', click: => @openConfig() }
{ type: 'separator' }
@@ -184,6 +188,9 @@ class AtomApplication
ipc.on 'new-window', =>
@open()
ipc.on 'get-version', (event) ->
event.result = getVersion()
sendCommand: (command) ->
atomWindow.sendCommand command for atomWindow in @windows when atomWindow.browserWindow.isFocused()