From 309a02b129b155d489cba1e352d1f436d4d9dc72 Mon Sep 17 00:00:00 2001 From: Quentin Decaunes Date: Fri, 1 Mar 2019 17:59:51 +0100 Subject: [PATCH] Automagically reset ryzenadj path to the one included. --- main.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 0896f2e..3fe5cde 100644 --- a/main.js +++ b/main.js @@ -7,6 +7,16 @@ if (setupEvents.handleSquirrelEvent()) { // Modules to control application life and create native browser window const {app, BrowserWindow, Menu, Tray} = require('electron') +const settings = require('electron-settings'); + +// Check for latest used version and clear settings if needed. +if (settings.get('settings.last_used_version') !== require('./package.json').version) { + settings.delete('settings.ryzen_adj_path'); + settings.set('settings', { + ...settings.set('settings'), + last_used_version: require('./package.json').version + }); +} // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. @@ -39,7 +49,6 @@ function createWindow () { mainWindow = null }) - const settings = require('electron-settings'); mainWindow.on('minimize',function(event){ if (settings.get('settings.minimize_to_tray')) { event.preventDefault();