mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-22 10:03:28 +07:00
fix: #43 Stop trying to apply settings when ryzenadj has not been set.
This commit is contained in:
parent
9d01b070d3
commit
ef35ffe128
@ -6,6 +6,7 @@ ready(function(){
|
||||
fixPath();
|
||||
displayOptions();
|
||||
preFillSettings();
|
||||
isRyzenAdjPathValid();
|
||||
loadLatestUsedSettings();
|
||||
registerRepeaterForAllInput();
|
||||
registerEventListenerForSettingsInput();
|
||||
@ -40,6 +41,10 @@ function applyRyzenSettings() {
|
||||
const child = require('child_process').execFile;
|
||||
const executablePath = getRyzenAdjExecutablePath();
|
||||
|
||||
if (!isRyzenAdjPathValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const options_data = require('./js/options_data.json');
|
||||
const ryzenAdjConvert = {
|
||||
"toHex": function (value) { return '0x' + decimalToHexString(value * 1000); },
|
||||
|
@ -246,13 +246,10 @@ function getRyzenAdjExecutablePath() {
|
||||
* Will fill settings page on render with saved data.
|
||||
*/
|
||||
function preFillSettings() {
|
||||
var ryzen_adj_path = document.getElementById('ryzen_adj_path');
|
||||
var fs = require('fs');
|
||||
ryzen_adj_path.value = getRyzenAdjExecutablePath();
|
||||
if (!fs.existsSync(ryzen_adj_path.value)) {
|
||||
notification('danger', "Path to ryzenadj.exe is wrong, please fix it in settings tab.");
|
||||
}
|
||||
const ryzen_adj_path = document.getElementById('ryzen_adj_path');
|
||||
const settings = require('electron-settings');
|
||||
|
||||
ryzen_adj_path.value = getRyzenAdjExecutablePath();
|
||||
document.getElementById('start_at_boot').checked = !!settings.get('settings.start_at_boot');
|
||||
document.getElementById('apply_last_settings_on_launch').checked = !!settings.get('settings.apply_last_settings_on_launch');
|
||||
document.getElementById('minimize_to_tray').checked = !!settings.get('settings.minimize_to_tray');
|
||||
@ -264,6 +261,22 @@ function preFillSettings() {
|
||||
document.getElementById('reapply_periodically_range').value = seconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ryzenadj executable has been registered and is valid.
|
||||
* Will display a notification if not.
|
||||
*
|
||||
* @return {Boolean} True if ryzenadj executable exists.
|
||||
*/
|
||||
function isRyzenAdjPathValid() {
|
||||
var fs = require('fs');
|
||||
|
||||
if (!fs.existsSync(getRyzenAdjExecutablePath())) {
|
||||
notification('danger', "Path to ryzenadj.exe is wrong, please fix it in settings tab.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will open a dialog to let user choose where is ryzenadj.exe.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user