Add support for launching HTML files directly

This commit is contained in:
Kevin Sawicki 2016-02-04 10:33:22 -08:00
parent 69687c92e9
commit 312182e0bd

View file

@ -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);