Do not run update script in dev environment

This commit is contained in:
JannisX11 2020-09-16 13:32:40 +02:00
parent 095233590f
commit abae9219b4

49
main.js
View File

@ -137,29 +137,36 @@ app.on('ready', () => {
createWindow()
autoUpdater.autoInstallOnAppQuit = true;
autoUpdater.autoDownload = false;
if (process.execPath && process.execPath.match(/electron\.\w+$/)) {
autoUpdater.on('update-available', (a) => {
console.log('update-available', a)
ipcMain.on('allow-auto-update', () => {
autoUpdater.downloadUpdate()
console.log('[Blockbench] Launching in development mode')
} else {
autoUpdater.autoInstallOnAppQuit = true;
autoUpdater.autoDownload = false;
autoUpdater.on('update-available', (a) => {
console.log('update-available', a)
ipcMain.on('allow-auto-update', () => {
autoUpdater.downloadUpdate()
})
orig_win.webContents.send('update-available');
})
orig_win.webContents.send('update-available');
})
autoUpdater.on('update-downloaded', (a) => {
console.log('update-downloaded', a)
orig_win.webContents.send('update-downloaded', a)
})
autoUpdater.on('error', (a) => {
console.log('update-error', a)
orig_win.webContents.send('update-error', a)
})
autoUpdater.on('download-progress', (a) => {
console.log('update-progress', a)
orig_win.webContents.send('update-progress', a)
})
autoUpdater.checkForUpdates().catch(err => {})
autoUpdater.on('update-downloaded', (a) => {
console.log('update-downloaded', a)
orig_win.webContents.send('update-downloaded', a)
})
autoUpdater.on('error', (a) => {
console.log('update-error', a)
orig_win.webContents.send('update-error', a)
})
autoUpdater.on('download-progress', (a) => {
console.log('update-progress', a)
orig_win.webContents.send('update-progress', a)
})
autoUpdater.checkForUpdates().catch(err => {})
}
})
app.on('window-all-closed', () => {