From 2e96cab6aa82fd9e77778699a761f19112181463 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 4 Feb 2016 10:07:19 -0800 Subject: [PATCH] Extract helper function to load specified app --- atom/browser/default_app/main.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/atom/browser/default_app/main.js b/atom/browser/default_app/main.js index c24fc12a..c562824d 100644 --- a/atom/browser/default_app/main.js +++ b/atom/browser/default_app/main.js @@ -234,12 +234,10 @@ if (option.modules.length > 0) { require('module')._preloadModules(option.modules); } -// Start the specified app if there is one specified in command line, otherwise -// start the default app. -if (option.file && !option.webdriver) { +function loadPackagePath(packagePath) { try { // Override app name and version. - var packagePath = path.resolve(option.file); + packagePath = path.resolve(packagePath); var packageJsonPath = path.join(packagePath, 'package.json'); if (fs.existsSync(packageJsonPath)) { var packageJson = JSON.parse(fs.readFileSync(packageJsonPath)); @@ -270,6 +268,12 @@ if (option.file && !option.webdriver) { throw e; } } +} + +// Start the specified app if there is one specified in command line, otherwise +// start the default app. +if (option.file && !option.webdriver) { + loadPackagePath(option.file); } else if (option.version) { console.log('v' + process.versions.electron); process.exit(0); -- 2.43.0