]> khamidou — GitHub mirrors - electron.git/commitdiff
Add support for launching HTML files directly
authorKevin Sawicki <kevinsawicki@gmail.com>
Thu, 4 Feb 2016 18:33:22 +0000 (10:33 -0800)
committerKevin Sawicki <kevinsawicki@gmail.com>
Thu, 4 Feb 2016 18:33:22 +0000 (10:33 -0800)
atom/browser/default_app/main.js

index 2b5c916749d36f2173fb7c98e5d36ec74fca4445..09082804b3cd22af9aff7d45f840ee040d9b267b 100644 (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);