From d7bc5a70885054e57e97befe38e02acb22c8263d Mon Sep 17 00:00:00 2001 From: Dick Choi Date: Mon, 4 Apr 2016 08:02:53 +0900 Subject: [PATCH] ready for linux app :) --- gruntfile.js | 25 ++++++++++++++++++------- lib/main-app.js | 28 ++++++++++++++-------------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index f7c81044..b02ee1ab 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -212,10 +212,22 @@ module.exports = function (grunt) { } }) - grunt.registerTask('build', function (platform) { - if (!platform) { - platform = process.platform === 'darwin' ? 'osx' : process.platform === 'win32' ? 'win' : null + function getTarget () { + switch (process.platform) { + case 'darwin': + return 'osx' + case 'win32': + return 'win' + case 'linux': + return 'linux' + default: + return process.platform } + } + + grunt.registerTask('build', function (platform) { + if (platform == null) platform = getTarget() + switch (platform) { case 'win': grunt.task.run(['compile', 'pack:win', 'create-windows-installer']) @@ -225,14 +237,13 @@ module.exports = function (grunt) { break case 'linux': grunt.task.run(['compile', 'pack:linux', 'electron-installer-debian']) - break; + break } }) grunt.registerTask('pre-build', function (platform) { - if (!platform) { - platform = process.platform === 'darwin' ? 'osx' : process.platform === 'win32' ? 'win' : null - } + if (platform == null) platform = getTarget() + switch (platform) { case 'win': grunt.task.run(['compile', 'pack:win']) diff --git a/lib/main-app.js b/lib/main-app.js index 4e6e10a0..c142f799 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -128,12 +128,13 @@ const updater = new GhReleases(ghReleasesOpts) // Check for updates // `status` returns true if there is a new update available function checkUpdate () { - // Disable check update(Linux only) - return true + if (process.platform === 'linux') { + return true + } updater.check((err, status) => { if (err) { console.error(err) - if (!versionNotified) notify('Updater error!', message) + if (!versionNotified) notify('Updater error!', err.message) } if (!err) { if (status) { @@ -277,18 +278,17 @@ app.on('ready', function () { mainWindow.hide() }) - // Disable Finder(Linux only) - // if (finderProcess == null && process.platform === 'darwin') { - // spawnFinder() - // } else { - // finderWindow = require('./finder-window') + if (finderProcess == null && process.platform === 'darwin') { + spawnFinder() + } else { + finderWindow = require('./finder-window') - // finderWindow.on('close', function (e) { - // if (appQuit) return true - // e.preventDefault() - // finderWindow.hide() - // }) - // } + finderWindow.on('close', function (e) { + if (appQuit) return true + e.preventDefault() + finderWindow.hide() + }) + } nodeIpc.server.start(function (err) { if (err.code === 'EADDRINUSE') {