From 1380e6e2fd950cfe3b71a587f18c7202642bd446 Mon Sep 17 00:00:00 2001 From: Quentin Decaunes Date: Thu, 28 Feb 2019 18:03:51 +0100 Subject: [PATCH] Added log area. --- index.html | 4 +++- js/methods.js | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 860322d..54cc1d7 100644 --- a/index.html +++ b/index.html @@ -83,7 +83,9 @@
  • Will be available soon!
  • -
  • Will be available soon!
  • +
  • + +
  • diff --git a/js/methods.js b/js/methods.js index 086bbbf..ed8f36f 100644 --- a/js/methods.js +++ b/js/methods.js @@ -12,7 +12,9 @@ function parseHTML(str) { * Return the current working directory. */ function getCurrentWorkingDirectory() { - return require('electron').remote.app.getAppPath(); + const cwd = require('electron').remote.app.getAppPath() + appendLog(`getCurrentWorkingDirectory(): ${cwd}`); + return cwd; } /** @@ -68,9 +70,9 @@ function checkForAdminRights() { exec('NET SESSION', function(err,so,se) { if (se.length !== 0) { notification('warning', - `Warning: you should launch this app as administrator, - ryzenadj.exe doesn't seems to work correctly without administrator rights. - `); + `Warning: you should launch this app as administrator,` + + `ryzenadj.exe doesn't seems to work correctly without administrator rights.` + ); } }); } @@ -81,6 +83,7 @@ function checkForAdminRights() { * @param {string} message The message to be displayed, new line will be replaced by
    . */ function notification(type, message) { + appendLog(`notification(): ${type}\n${message}`); UIkit.notification({ message: (''+message).replace(/(?:\r\n|\r|\n)/g, '
    '), status: type, @@ -98,6 +101,7 @@ function getRyzenAdjExecutablePath() { if (!ryzen_adj_path) { ryzen_adj_path = getCurrentWorkingDirectory() + "\\bin\\ryzenadj.exe"; } + appendLog(`getRyzenAdjExecutablePath(): ${ryzen_adj_path}`); return ryzen_adj_path; } @@ -118,7 +122,7 @@ function askingForRyzenAdjExecutablePath() { var dialog = remote.require('electron').dialog; var path = dialog.showOpenDialog({ - properties: ['openFile'] + properties: ['openFile'] }, function (filePaths) { if (typeof filePaths[0] !== 'undefined') { const settings = require('electron-settings'); @@ -126,9 +130,15 @@ function askingForRyzenAdjExecutablePath() { ryzen_adj_path: filePaths[0] }); notification('primary', 'Path to ryzenAdj.exe has been saved.'); + appendLog(`askingForRyzenAdjExecutablePath(): ${filePaths[0]}`); } else { notification('warning', 'No path given, nothing changed.'); } preFillSettings(); }); } + +function appendLog(message) { + var log_area = document.getElementById('logs'); + log_area.value += message + "\n"; +} \ No newline at end of file