fix "about" window in packaged context

This commit is contained in:
Christopher Willis-Ford 2019-07-28 18:40:58 -07:00
parent 8dcbbfe5c9
commit 53812d79c7

View file

@ -16,7 +16,7 @@ const isDevelopment = process.env.NODE_ENV !== 'production';
// global window references prevent them from being garbage-collected // global window references prevent them from being garbage-collected
const _windows = {}; const _windows = {};
const createWindow = ({url, ...browserWindowOptions}) => { const createWindow = ({search = null, url = 'index.html', ...browserWindowOptions}) => {
const window = new BrowserWindow({ const window = new BrowserWindow({
useContentSize: true, useContentSize: true,
show: false, show: false,
@ -48,6 +48,7 @@ const createWindow = ({url, ...browserWindowOptions}) => {
window.loadURL(formatUrl({ window.loadURL(formatUrl({
pathname: path.join(__dirname, url), pathname: path.join(__dirname, url),
protocol: 'file', protocol: 'file',
search,
slashes: true slashes: true
})); }));
} }
@ -60,8 +61,8 @@ const createAboutWindow = () => {
width: 400, width: 400,
height: 400, height: 400,
parent: _windows.main, parent: _windows.main,
title: 'About Scratch Desktop', search: 'route=about',
url: 'index.html?route=about' title: 'About Scratch Desktop'
}); });
return window; return window;
}; };
@ -70,8 +71,7 @@ const createMainWindow = () => {
const window = createWindow({ const window = createWindow({
width: defaultSize.width, width: defaultSize.width,
height: defaultSize.height, height: defaultSize.height,
title: 'Scratch Desktop', title: 'Scratch Desktop'
url: 'index.html'
}); });
const webContents = window.webContents; const webContents = window.webContents;