From 8fccd53a1854975569d9d3e0d1090b8a63ccdd24 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Tue, 15 Aug 2017 14:02:26 +0200 Subject: [PATCH] Fix loading of index.html #40 https://electron.atom.io/docs/tutorial/quick-start/ --- src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index c243ce82..2011c6d4 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,7 @@ const electron = require('electron'); // eslint-disable-line const isDev = require('electron-is-dev'); +const path = require('path'); +const url = require('url'); const menu = require('./menu'); @@ -18,7 +20,11 @@ function createWindow() { mainWindow = new BrowserWindow({ darkTheme: true, }); - mainWindow.loadURL(`file://${__dirname}/index.html`); + mainWindow.loadURL(url.format({ + pathname: path.join(__dirname, 'index.html'), + protocol: 'file:', + slashes: true, + })); mainWindow.on('closed', () => { // Dereference the window object, usually you would store windows