From 312182e0bdd8d71cf7a26ffaa54daf825ad7fbb8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 4 Feb 2016 10:33:22 -0800 Subject: [PATCH] Add support for launching HTML files directly --- atom/browser/default_app/main.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/atom/browser/default_app/main.js b/atom/browser/default_app/main.js index 2b5c916..0908280 100644 --- a/atom/browser/default_app/main.js +++ b/atom/browser/default_app/main.js @@ -278,11 +278,15 @@ function loadApplicationByUrl(appUrl) { // Start the specified app if there is one specified in command line, otherwise // start the default app. if (option.file && !option.webdriver) { - var protocol = url.parse(option.file).protocol; + var file = option.file; + var protocol = url.parse(file).protocol; + var extension = path.extname(file); if (protocol === 'http:' || protocol === 'https:') { - loadApplicationByUrl(option.file); + loadApplicationByUrl(file); + } else if (extension === '.html' || extension === '.htm') { + loadApplicationByUrl('file://' + path.resolve(file)); } else { - loadPackagePath(option.file); + loadPackagePath(file); } } else if (option.version) { console.log('v' + process.versions.electron); -- 2.7.4