From a00fe91fcaa2c1fbdf9c39b8bdf5d5b82904ba81 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 24 May 2013 23:24:46 +0800 Subject: [PATCH] Show Atom's version. --- atom.gyp | 19 +++++++++++++++++++ script/generate-version | 3 +++ src/app/atom.coffee | 2 +- src/main.coffee | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 script/generate-version diff --git a/atom.gyp b/atom.gyp index eee544752..84c29f90f 100644 --- a/atom.gyp +++ b/atom.gyp @@ -1,4 +1,7 @@ { + 'variables': { + 'version%': " $2 diff --git a/src/app/atom.coffee b/src/app/atom.coffee index f730f5cd8..a84b28ba0 100644 --- a/src/app/atom.coffee +++ b/src/app/atom.coffee @@ -262,4 +262,4 @@ window.atom = console.error "Failed to load `#{userInitScriptPath}`", error.stack, error getVersion: -> - @sendMessageToBrowserProcess('getVersion') + ipc.sendChannelSync 'get-version' diff --git a/src/main.coffee b/src/main.coffee index ad7da3473..70dac27cf 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -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()