mirror of
https://github.com/netzbegruenung/Rocket.Chat.Electron.git
synced 2024-05-05 15:33:40 +02:00
Read update settings from install location
This commit is contained in:
parent
73f926c682
commit
b8e4ca3931
4
dev-app-update.yml
Normal file
4
dev-app-update.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
owner: RocketChat
|
||||
repo: Rocket.Chat.Electron
|
||||
provider: github
|
||||
vPrefixedTagName: false
|
|
@ -2,6 +2,7 @@ import { app, ipcMain, BrowserWindow, dialog } from 'electron';
|
|||
import { autoUpdater } from 'electron-updater';
|
||||
import jetpack from 'fs-jetpack';
|
||||
|
||||
const installDir = jetpack.cwd(app.getAppPath());
|
||||
const userDataDir = jetpack.cwd(app.getPath('userData'));
|
||||
const updateStoreFile = 'update.json';
|
||||
let checkForUpdatesEvent;
|
||||
|
@ -10,7 +11,9 @@ autoUpdater.autoDownload = false;
|
|||
|
||||
let updateFile = {};
|
||||
try {
|
||||
updateFile = userDataDir.read(updateStoreFile, 'json') || {};
|
||||
const installUpdateFile = installDir.read(updateStoreFile, 'json');
|
||||
const userUpdateFile = userDataDir.read(updateStoreFile, 'json');
|
||||
updateFile = Object.assign({}, installUpdateFile, userUpdateFile);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
@ -121,7 +124,7 @@ function checkForUpdates () {
|
|||
updateFile.autoUpdate = autoUpdate;
|
||||
userDataDir.write(updateStoreFile, updateFile, { atomic: true });
|
||||
} else if (autoUpdate === 'auto') {
|
||||
e.returnValue = !!updateFile.autoUpdate;
|
||||
e.returnValue = updateFile.autoUpdate !== false;
|
||||
} else {
|
||||
checkForUpdatesEvent = e;
|
||||
autoUpdater.checkForUpdates();
|
||||
|
|
Loading…
Reference in a new issue