From 995d109c329fc0ee15d4aba96eb7e6569f3c2c35 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 31 Oct 2016 10:32:20 -0700 Subject: [PATCH 1/3] Format URL passed to BrowserWindow.loadURL --- main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index fdce321..7ae3ec7 100644 --- a/main.js +++ b/main.js @@ -4,6 +4,8 @@ const app = electron.app // Module to create native browser window. const BrowserWindow = electron.BrowserWindow +const url = require('url') + // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. let mainWindow @@ -13,7 +15,11 @@ function createWindow () { mainWindow = new BrowserWindow({width: 800, height: 600}) // and load the index.html of the app. - mainWindow.loadURL(`file://${__dirname}/index.html`) + mainWindow.loadURL(url.format({ + pathname: __dirname + '/index.html', + protocol: 'file:', + slashes: true + })) // Open the DevTools. mainWindow.webContents.openDevTools() From 0af284c37cb6360d14f39d5839dea10fb7d0a5a7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 31 Oct 2016 10:36:11 -0700 Subject: [PATCH 2/3] Use path.join for pathname --- main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 7ae3ec7..623740a 100644 --- a/main.js +++ b/main.js @@ -4,6 +4,7 @@ const app = electron.app // Module to create native browser window. const BrowserWindow = electron.BrowserWindow +const path = require('path') const url = require('url') // Keep a global reference of the window object, if you don't, the window will @@ -16,7 +17,7 @@ function createWindow () { // and load the index.html of the app. mainWindow.loadURL(url.format({ - pathname: __dirname + '/index.html', + pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true })) From af3f71dda3dc5bb90ed8c80c49df0a71ffe482f4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 31 Oct 2016 10:38:04 -0700 Subject: [PATCH 3/3] Separate install and start steps --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 130ef6c..5760d95 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,10 @@ To clone and run this repository you'll need [Git](https://git-scm.com) and [Nod git clone https://github.com/electron/electron-quick-start # Go into the repository cd electron-quick-start -# Install dependencies and run the app -npm install && npm start +# Install dependencies +npm install +# Run the app +npm start ``` Learn more about Electron and its API in the [documentation](http://electron.atom.io/docs/latest).