Fix platform detection

This commit is contained in:
Scott E. Graves
2019-04-17 21:35:52 -05:00
parent 402968e918
commit 600c81acce
3 changed files with 9 additions and 6 deletions

View File

@@ -617,17 +617,20 @@ ipcMain.on(Constants.IPC_Get_Platform, (event) => {
.then(data => { .then(data => {
platform = data.replace(/(\r\n|\n|\r)/gm,""); platform = data.replace(/(\r\n|\n|\r)/gm,"");
event.sender.send(Constants.IPC_Get_Platform_Reply, { event.sender.send(Constants.IPC_Get_Platform_Reply, {
data: platform, OSPlatform: os.platform(),
Platform: platform,
}); });
}) })
.catch(() => { .catch(() => {
event.sender.send(Constants.IPC_Get_Platform_Reply, { event.sender.send(Constants.IPC_Get_Platform_Reply, {
data: platform, OSPlatform: os.platform(),
Platform: platform,
}); });
}); });
} else { } else {
event.sender.send(Constants.IPC_Get_Platform_Reply, { event.sender.send(Constants.IPC_Get_Platform_Reply, {
data: platform, OSPlatform: os.platform(),
Platform: platform,
}); });
} }
}); });

View File

@@ -15,7 +15,7 @@
--heading_other_text_color: var(--heading_text_color); --heading_other_text_color: var(--heading_text_color);
--text_color_transition: color 0.3s; --text_color_transition: color 0.3s;
--default_font_size: 4.8vmin --default_font_size: 4vmin
} }
* { * {

View File

@@ -11,12 +11,12 @@ if (!process.versions.hasOwnProperty('electron')) {
const ipcRenderer = ((window && window.require) ? window.require('electron').ipcRenderer : null); const ipcRenderer = ((window && window.require) ? window.require('electron').ipcRenderer : null);
if (ipcRenderer) { if (ipcRenderer) {
ipcRenderer.on(Constants.IPC_Get_Platform_Reply, (event, arg) => { ipcRenderer.on(Constants.IPC_Get_Platform_Reply, (event, arg) => {
if (arg.data === 'linux') { if (arg.OSPlatform === 'linux') {
let root = document.documentElement; let root = document.documentElement;
root.style.setProperty('--default_font_size', '4.8vmin'); root.style.setProperty('--default_font_size', '4.8vmin');
} }
ReactDOM.render(<App platform={arg.data} version={packageJson.version}/>, document.getElementById('root')); ReactDOM.render(<App platform={arg.Platform} version={packageJson.version}/>, document.getElementById('root'));
serviceWorker.unregister(); serviceWorker.unregister();
}); });
ipcRenderer.send(Constants.IPC_Get_Platform); ipcRenderer.send(Constants.IPC_Get_Platform);