Add support for launching HTML files directly
This commit is contained in:
parent
69687c92e9
commit
312182e0bd
1 changed files with 7 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue